import pandas as pd
import numpy as np
%matplotlib inline
from matplotlib import pyplot as plt
suicide_x = pd.read_csv(r"D:\Downloads\suicides_in_india.csv")
suicide_df= pd.DataFrame(suicide_x)
suicide_df
df_2001 = suicide_df.loc[(suicide_df["Year"]==2001)]
df_2001
t2001_dcount = df_2001.loc[:,"Total"]
s1_1 = np.sum(t2001_dcount)
s1_1
male_2001 = df_2001.loc[(df_2001["Gender"]=="Male")]
male_2001
m2001_count = male_2001.loc[:,"Total"]
s1_2 = np.sum(m2001_count)
s1_2
female_2001 = df_2001.loc[(df_2001["Gender"]=="Female")]
female_2001
fm2001_count = female_2001.loc[:,"Total"]
s1_3 = np.sum(fm2001_count)
s1_3
df_age_d014_2001 = df_2001.loc[(df_2001["Age_group"]=="0-14")]
df_age_d014_2001
t_014_2001 = df_age_d014_2001.loc[:,"Total"]
s1_4 = np.sum(t_014_2001)
s1_4
df_age_d1529_2001 = df_2001.loc[(df_2001["Age_group"]=="15-29")]
df_age_d1529_2001
t_1529_2001 = df_age_d1529_2001.loc[:,"Total"]
s1_5 = np.sum(t_1529_2001)
s1_5
df_age_d3044_2001 = df_2001.loc[(df_2001["Age_group"]=="30-44")]
df_age_d3044_2001
t_3044_2001 = df_age_d3044_2001.loc[:,"Total"]
s1_6 = np.sum(t_3044_2001)
s1_6
df_age_d4559_2001 = df_2001.loc[(df_2001["Age_group"]=="45-59")]
df_age_d4559_2001
t_4559_2001 = df_age_d4559_2001.loc[:,"Total"]
s1_7 = np.sum(t_4559_2001)
s1_7
df_age_d60_2001 = df_2001.loc[(df_2001["Age_group"]=="60+")]
df_age_d60_2001
t_60_2001 = df_age_d60_2001.loc[:,"Total"]
s1_8 = np.sum(t_60_2001)
s1_8
df_age_d0100_2001 = df_2001.loc[(df_2001["Age_group"]=="0-100+")]
df_age_d0100_2001
t_0100_2001 = df_age_d0100_2001.loc[:,"Total"]
s1_54 = np.sum(t_0100_2001)
s1_54
df_014m_2001 = df_age_d014_2001.loc[(df_age_d014_2001["Gender"]=="Male")]
df_014m_2001
t_014m_2001 = df_014m_2001.loc[:,"Total"]
s1_9 = np.sum(t_014m_2001)
s1_9
df_014fm_2001 = df_age_d014_2001.loc[(df_age_d014_2001["Gender"]=="Female")]
df_014fm_2001
t_014fm_2001 = df_014fm_2001.loc[:,"Total"]
s1_10 = np.sum(t_014fm_2001)
s1_10
df_1529m_2001 = df_age_d1529_2001.loc[(df_age_d1529_2001["Gender"]=="Male")]
df_1529m_2001
t_1529m_2001 = df_1529m_2001.loc[:,"Total"]
s1_11 = np.sum(t_1529m_2001)
s1_11
df_1529fm_2001 = df_age_d1529_2001.loc[(df_age_d1529_2001["Gender"]=="Female")]
df_1529fm_2001
t_1529fm_2001 = df_1529fm_2001.loc[:,"Total"]
s1_12 = np.sum(t_1529fm_2001)
s1_12
df_3044m_2001 = df_age_d3044_2001.loc[(df_age_d3044_2001["Gender"]=="Male")]
df_3044m_2001
t_3044m_2001 = df_3044m_2001.loc[:,"Total"]
s1_13 = np.sum(t_3044m_2001)
s1_13
df_3044fm_2001 = df_age_d3044_2001.loc[(df_age_d3044_2001["Gender"]=="Female")]
df_3044fm_2001
t_3044fm_2001 = df_3044fm_2001.loc[:,"Total"]
s1_14 = np.sum(t_3044fm_2001)
s1_14
df_4559m_2001 = df_age_d4559_2001.loc[(df_age_d4559_2001["Gender"]=="Male")]
df_4559m_2001
t_4559m_2001 = df_4559m_2001.loc[:,"Total"]
s1_15 = np.sum(t_4559m_2001)
s1_15
df_4559fm_2001 = df_age_d4559_2001.loc[(df_age_d4559_2001["Gender"]=="Female")]
df_4559fm_2001
t_4559fm_2001 = df_4559fm_2001.loc[:,"Total"]
s1_16 = np.sum(t_4559fm_2001)
s1_16
df_60m_2001 = df_age_d60_2001.loc[(df_age_d60_2001["Gender"]=="Male")]
df_60m_2001
t_60m_2001 = df_60m_2001.loc[:,"Total"]
s1_17 = np.sum(t_60m_2001)
s1_17
df_60fm_2001 = df_age_d60_2001.loc[(df_age_d60_2001["Gender"]=="Female")]
df_60fm_2001
t_60fm_2001 = df_60fm_2001.loc[:,"Total"]
s1_18 = np.sum(t_60fm_2001)
s1_18
df_0100fm_2001 = df_age_d0100_2001.loc[(df_age_d0100_2001["Gender"]=="Female")]
df_0100fm_2001
t_0100fm_2001 = df_0100fm_2001.loc[:,"Total"]
s1_55 = np.sum(t_0100fm_2001)
s1_55
df_0100m_2001 = df_age_d0100_2001.loc[(df_age_d0100_2001["Gender"]=="Male")]
df_0100m_2001
t_0100m_2001 = df_0100m_2001.loc[:,"Total"]
s1_56 = np.sum(t_0100m_2001)
s1_56
df_st_AN_2001 = df_2001.loc[(df_2001["State"]=="A & N ISLANDS")]
df_st_AN_2001
t_AN_2001 = df_st_AN_2001.loc[:,"Total"]
s1_19 = np.sum(t_AN_2001)
s1_19
df_st_AP_2001 = df_2001.loc[(df_2001["State"]=="ANDHRA PRADESH")]
df_st_AP_2001
t_AP_2001 = df_st_AP_2001.loc[:,"Total"]
s1_20 = np.sum(t_AP_2001)
s1_20
df_st_ARP_2001 = df_2001.loc[(df_2001["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2001
t_ARP_2001 = df_st_ARP_2001.loc[:,"Total"]
s1_21 = np.sum(t_ARP_2001)
s1_21
df_st_AS_2001 = df_2001.loc[(df_2001["State"]=="ASSAM")]
df_st_AS_2001
t_AS_2001 = df_st_AS_2001.loc[:,"Total"]
s1_22 = np.sum(t_AS_2001)
s1_22
df_st_BH_2001 = df_2001.loc[(df_2001["State"]=="BIHAR")]
df_st_BH_2001
t_BH_2001 = df_st_BH_2001.loc[:,"Total"]
s1_23 = np.sum(t_BH_2001)
s1_23
df_st_CH_2001 = df_2001.loc[(df_2001["State"]=="CHANDIGARH")]
df_st_CH_2001
t_CH_2001 = df_st_CH_2001.loc[:,"Total"]
s1_24 = np.sum(t_CH_2001)
s1_24
df_st_CT_2001 = df_2001.loc[(df_2001["State"]=="CHHATTISGARH")]
df_st_CT_2001
t_CT_2001 = df_st_CT_2001.loc[:,"Total"]
s1_25 = np.sum(t_CT_2001)
s1_25
df_st_DN_2001 = df_2001.loc[(df_2001["State"]=="D & N HAVELI")]
df_st_DN_2001
t_DN_2001 = df_st_DN_2001.loc[:,"Total"]
s1_26 = np.sum(t_DN_2001)
s1_26
df_st_DD_2001 = df_2001.loc[(df_2001["State"]=="DAMAN & DIU")]
df_st_DD_2001
t_DD_2001 = df_st_DD_2001.loc[:,"Total"]
s1_27 = np.sum(t_DD_2001)
s1_27
df_st_DL_2001 = df_2001.loc[(df_2001["State"]=="DELHI (UT)")]
df_st_DL_2001
t_DL_2001 = df_st_DL_2001.loc[:,"Total"]
s1_28 = np.sum(t_DL_2001)
s1_28
df_st_GOA_2001 = df_2001.loc[(df_2001["State"]=="GOA")]
df_st_GOA_2001
t_GOA_2001 = df_st_GOA_2001.loc[:,"Total"]
s1_29 = np.sum(t_GOA_2001)
s1_29
df_st_GJ_2001 = df_2001.loc[(df_2001["State"]=="GUJARAT")]
df_st_GJ_2001
t_GJ_2001 = df_st_GJ_2001.loc[:,"Total"]
s1_30 = np.sum(t_GJ_2001)
s1_30
df_st_HR_2001 = df_2001.loc[(df_2001["State"]=="HARYANA")]
df_st_HR_2001
t_HR_2001 = df_st_HR_2001.loc[:,"Total"]
s1_31 = np.sum(t_HR_2001)
s1_31
df_st_HP_2001 = df_2001.loc[(df_2001["State"]=="HIMACHAL PRADESH")]
df_st_HP_2001
t_HP_2001 = df_st_HP_2001.loc[:,"Total"]
s1_32 = np.sum(t_HP_2001)
s1_32
df_st_JK_2001 = df_2001.loc[(df_2001["State"]=="JAMMU & KASHMIR")]
df_st_JK_2001
t_JK_2001 = df_st_JK_2001.loc[:,"Total"]
s1_33 = np.sum(t_JK_2001)
s1_33
df_st_JH_2001 = df_2001.loc[(df_2001["State"]=="JHARKHAND")]
df_st_JH_2001
t_JH_2001 = df_st_JH_2001.loc[:,"Total"]
s1_34 = np.sum(t_JH_2001)
s1_34
df_st_KN_2001 = df_2001.loc[(df_2001["State"]=="KARNATAKA")]
df_st_KN_2001
t_KN_2001 = df_st_KN_2001.loc[:,"Total"]
s1_35 = np.sum(t_KN_2001)
s1_35
df_st_KER_2001 = df_2001.loc[(df_2001["State"]=="KERALA")]
df_st_KER_2001
t_KER_2001 = df_st_KER_2001.loc[:,"Total"]
s1_36 = np.sum(t_KER_2001)
s1_36
df_st_LD_2001 = df_2001.loc[(df_2001["State"]=="LAKSHADWEEP")]
df_st_LD_2001
t_LD_2001 = df_st_LD_2001.loc[:,"Total"]
s1_37 = np.sum(t_LD_2001)
s1_37
df_st_MP_2001 = df_2001.loc[(df_2001["State"]=="MADHYA PRADESH")]
df_st_MP_2001
t_MP_2001 = df_st_MP_2001.loc[:,"Total"]
s1_38 = np.sum(t_MP_2001)
s1_38
df_st_MH_2001 = df_2001.loc[(df_2001["State"]=="MAHARASHTRA")]
df_st_MH_2001
t_MH_2001 = df_st_MH_2001.loc[:,"Total"]
s1_39 = np.sum(t_MH_2001)
s1_39
df_st_MN_2001 = df_2001.loc[(df_2001["State"]=="MANIPUR")]
df_st_MN_2001
t_MN_2001 = df_st_MN_2001.loc[:,"Total"]
s1_40 = np.sum(t_MN_2001)
s1_40
df_st_MG_2001 = df_2001.loc[(df_2001["State"]=="MEGHALAYA")]
df_st_MG_2001
t_MG_2001 = df_st_MG_2001.loc[:,"Total"]
s1_41 = np.sum(t_MG_2001)
s1_41
df_st_MZ_2001 = df_2001.loc[(df_2001["State"]=="MIZORAM")]
df_st_MZ_2001
t_MN_2001 = df_st_MN_2001.loc[:,"Total"]
s1_42 = np.sum(t_MN_2001)
s1_42
df_st_NG_2001 = df_2001.loc[(df_2001["State"]=="NAGALAND")]
df_st_NG_2001
t_NG_2001 = df_st_NG_2001.loc[:,"Total"]
s1_43 = np.sum(t_NG_2001)
s1_43
df_st_OD_2001 = df_2001.loc[(df_2001["State"]=="ODISHA")]
df_st_OD_2001
t_OD_2001 = df_st_OD_2001.loc[:,"Total"]
s1_44 = np.sum(t_OD_2001)
s1_44
df_st_PD_2001 = df_2001.loc[(df_2001["State"]=="PUDUCHERRY")]
df_st_PD_2001
t_PD_2001 = df_st_PD_2001.loc[:,"Total"]
s1_45 = np.sum(t_PD_2001)
s1_45
df_st_PB_2001 = df_2001.loc[(df_2001["State"]=="PUNJAB")]
df_st_PB_2001
t_PB_2001 = df_st_PB_2001.loc[:,"Total"]
s1_46 = np.sum(t_PB_2001)
s1_46
df_st_RJ_2001 = df_2001.loc[(df_2001["State"]=="RAJASTHAN")]
df_st_RJ_2001
t_RJ_2001 = df_st_RJ_2001.loc[:,"Total"]
s1_47 = np.sum(t_RJ_2001)
s1_47
df_st_SM_2001 = df_2001.loc[(df_2001["State"]=="SIKKIM")]
df_st_SM_2001
t_SM_2001 = df_st_SM_2001.loc[:,"Total"]
s1_48 = np.sum(t_SM_2001)
s1_48
df_st_TN_2001 = df_2001.loc[(df_2001["State"]=="TAMIL NADU")]
df_st_TN_2001
t_TN_2001 = df_st_TN_2001.loc[:,"Total"]
s1_49 = np.sum(t_TN_2001)
s1_49
df_st_TP_2001 = df_2001.loc[(df_2001["State"]=="TRIPURA")]
df_st_TP_2001
t_TP_2001 = df_st_TP_2001.loc[:,"Total"]
s1_50 = np.sum(t_TP_2001)
s1_50
df_st_UP_2001 = df_2001.loc[(df_2001["State"]=="UTTAR PRADESH")]
df_st_UP_2001
t_UP_2001 = df_st_UP_2001.loc[:,"Total"]
s1_51 = np.sum(t_UP_2001)
s1_51
df_st_UK_2001 = df_2001.loc[(df_2001["State"]=="UTTARAKHAND")]
df_st_UK_2001
t_UK_2001 = df_st_UK_2001.loc[:,"Total"]
s1_52 = np.sum(t_UK_2001)
s1_52
df_st_WB_2001 = df_2001.loc[(df_2001["State"]=="WEST BENGAL")]
df_st_WB_2001
t_WB_2001 = df_st_WB_2001.loc[:,"Total"]
s1_53 = np.sum(t_WB_2001)
s1_53
t_ANm_2001 = np.sum(df_st_AN_2001.where(df_st_AN_2001["Gender"]=="Male")["Total"])
t_ANm_2001
t_ANfm_2001 = np.sum(df_st_AN_2001.where(df_st_AN_2001["Gender"]=="Female")["Total"])
t_ANfm_2001
t_APm_2001 = np.sum(df_st_AP_2001.where(df_st_AP_2001["Gender"]=="Male")["Total"])
t_APm_2001
t_APfm_2001 = np.sum(df_st_AP_2001.where(df_st_AP_2001["Gender"]=="Female")["Total"])
t_APfm_2001
t_ARPm_2001 = np.sum(df_st_ARP_2001.where(df_st_ARP_2001["Gender"]=="Male")["Total"])
t_ARPm_2001
t_ARPfm_2001 = np.sum(df_st_ARP_2001.where(df_st_ARP_2001["Gender"]=="Female")["Total"])
t_ARPfm_2001
t_ASm_2001 = np.sum(df_st_AS_2001.where(df_st_AS_2001["Gender"]=="Male")["Total"])
t_ASm_2001
t_ASfm_2001 = np.sum(df_st_AS_2001.where(df_st_AS_2001["Gender"]=="Female")["Total"])
t_ASfm_2001
t_BHm_2001 = np.sum(df_st_BH_2001.where(df_st_BH_2001["Gender"]=="Male")["Total"])
t_BHm_2001
t_BHfm_2001 = np.sum(df_st_BH_2001.where(df_st_BH_2001["Gender"]=="Female")["Total"])
t_BHfm_2001
t_CHm_2001 = np.sum(df_st_CH_2001.where(df_st_CH_2001["Gender"]=="Male")["Total"])
t_CHm_2001
t_CHfm_2001 = np.sum(df_st_CH_2001.where(df_st_CH_2001["Gender"]=="Female")["Total"])
t_CHfm_2001
t_CTm_2001 = np.sum(df_st_CT_2001.where(df_st_CT_2001["Gender"]=="Male")["Total"])
t_CTm_2001
t_CTfm_2001 = np.sum(df_st_CT_2001.where(df_st_CT_2001["Gender"]=="Female")["Total"])
t_CTfm_2001
t_DNm_2001 = np.sum(df_st_DN_2001.where(df_st_DN_2001["Gender"]=="Male")["Total"])
t_DNm_2001
t_DNfm_2001 = np.sum(df_st_DN_2001.where(df_st_DN_2001["Gender"]=="Female")["Total"])
t_DNfm_2001
t_DDm_2001 = np.sum(df_st_DD_2001.where(df_st_DD_2001["Gender"]=="Male")["Total"])
t_DDm_2001
t_DDfm_2001 = np.sum(df_st_DD_2001.where(df_st_DD_2001["Gender"]=="Female")["Total"])
t_DDfm_2001
t_DLm_2001 = np.sum(df_st_DL_2001.where(df_st_DL_2001["Gender"]=="Male")["Total"])
t_DLm_2001
t_DLfm_2001 = np.sum(df_st_DL_2001.where(df_st_DL_2001["Gender"]=="Female")["Total"])
t_DLfm_2001
t_GOAm_2001 = np.sum(df_st_GOA_2001.where(df_st_GOA_2001["Gender"]=="Male")["Total"])
t_GOAm_2001
t_GOAfm_2001 = np.sum(df_st_GOA_2001.where(df_st_GOA_2001["Gender"]=="Female")["Total"])
t_GOAfm_2001
t_GJm_2001 = np.sum(df_st_GJ_2001.where(df_st_GJ_2001["Gender"]=="Male")["Total"])
t_GJm_2001
t_GJfm_2001 = np.sum(df_st_GJ_2001.where(df_st_GJ_2001["Gender"]=="Female")["Total"])
t_GJfm_2001
t_HRm_2001 = np.sum(df_st_HR_2001.where(df_st_HR_2001["Gender"]=="Male")["Total"])
t_HRm_2001
t_HRfm_2001 = np.sum(df_st_HR_2001.where(df_st_HR_2001["Gender"]=="Female")["Total"])
t_HRfm_2001
t_HPm_2001 = np.sum(df_st_HP_2001.where(df_st_HP_2001["Gender"]=="Male")["Total"])
t_HPm_2001
t_HPfm_2001 = np.sum(df_st_HP_2001.where(df_st_HP_2001["Gender"]=="Female")["Total"])
t_HPfm_2001
t_JKm_2001 = np.sum(df_st_JK_2001.where(df_st_JK_2001["Gender"]=="Male")["Total"])
t_JKm_2001
t_JKfm_2001 = np.sum(df_st_JK_2001.where(df_st_JK_2001["Gender"]=="Female")["Total"])
t_JKfm_2001
t_JHm_2001 = np.sum(df_st_JH_2001.where(df_st_JH_2001["Gender"]=="Male")["Total"])
t_JHm_2001
t_JHfm_2001 = np.sum(df_st_JH_2001.where(df_st_JH_2001["Gender"]=="Female")["Total"])
t_JHfm_2001
t_KNm_2001 = np.sum(df_st_KN_2001.where(df_st_KN_2001["Gender"]=="Male")["Total"])
t_KNm_2001
t_KNfm_2001 = np.sum(df_st_KN_2001.where(df_st_KN_2001["Gender"]=="Female")["Total"])
t_KNfm_2001
t_KERm_2001 = np.sum(df_st_KER_2001.where(df_st_KER_2001["Gender"]=="Male")["Total"])
t_KERm_2001
t_KERfm_2001 = np.sum(df_st_KER_2001.where(df_st_KER_2001["Gender"]=="Female")["Total"])
t_KERfm_2001
t_LDm_2001 = np.sum(df_st_LD_2001.where(df_st_LD_2001["Gender"]=="Male")["Total"])
t_LDm_2001
t_LDfm_2001 = np.sum(df_st_LD_2001.where(df_st_LD_2001["Gender"]=="Female")["Total"])
t_LDfm_2001
t_MPm_2001 = np.sum(df_st_MP_2001.where(df_st_MP_2001["Gender"]=="Male")["Total"])
t_MPm_2001
t_MPfm_2001 = np.sum(df_st_MP_2001.where(df_st_MP_2001["Gender"]=="Female")["Total"])
t_MPfm_2001
t_MHm_2001 = np.sum(df_st_MH_2001.where(df_st_MH_2001["Gender"]=="Male")["Total"])
t_MHm_2001
t_MHfm_2001 = np.sum(df_st_MH_2001.where(df_st_MH_2001["Gender"]=="Female")["Total"])
t_MHfm_2001
t_MNm_2001 = np.sum(df_st_MN_2001.where(df_st_MN_2001["Gender"]=="Male")["Total"])
t_MNm_2001
t_MNfm_2001 = np.sum(df_st_MN_2001.where(df_st_MN_2001["Gender"]=="Female")["Total"])
t_MNfm_2001
t_MGm_2001 = np.sum(df_st_MG_2001.where(df_st_MG_2001["Gender"]=="Male")["Total"])
t_MGm_2001
t_MGfm_2001 = np.sum(df_st_MG_2001.where(df_st_MG_2001["Gender"]=="Female")["Total"])
t_MGfm_2001
t_MZm_2001 = np.sum(df_st_MZ_2001.where(df_st_MZ_2001["Gender"]=="Male")["Total"])
t_MZm_2001
t_MZfm_2001 = np.sum(df_st_MZ_2001.where(df_st_MZ_2001["Gender"]=="Female")["Total"])
t_MZfm_2001
t_NGm_2001 = np.sum(df_st_NG_2001.where(df_st_NG_2001["Gender"]=="Male")["Total"])
t_NGm_2001
t_NGfm_2001 = np.sum(df_st_NG_2001.where(df_st_NG_2001["Gender"]=="Female")["Total"])
t_MGfm_2001
t_ODm_2001 = np.sum(df_st_OD_2001.where(df_st_OD_2001["Gender"]=="Male")["Total"])
t_ODm_2001
t_ODfm_2001 = np.sum(df_st_OD_2001.where(df_st_OD_2001["Gender"]=="Female")["Total"])
t_ODfm_2001
t_PDm_2001 = np.sum(df_st_PD_2001.where(df_st_PD_2001["Gender"]=="Male")["Total"])
t_PDm_2001
t_PDfm_2001 = np.sum(df_st_PD_2001.where(df_st_PD_2001["Gender"]=="Female")["Total"])
t_PDfm_2001
t_PBm_2001 = np.sum(df_st_PB_2001.where(df_st_PB_2001["Gender"]=="Male")["Total"])
t_PBm_2001
t_PBfm_2001 = np.sum(df_st_PB_2001.where(df_st_PB_2001["Gender"]=="Female")["Total"])
t_PBfm_2001
t_RJm_2001 = np.sum(df_st_RJ_2001.where(df_st_RJ_2001["Gender"]=="Male")["Total"])
t_RJm_2001
t_RJfm_2001 = np.sum(df_st_RJ_2001.where(df_st_RJ_2001["Gender"]=="Female")["Total"])
t_RJfm_2001
t_SMm_2001 = np.sum(df_st_SM_2001.where(df_st_SM_2001["Gender"]=="Male")["Total"])
t_SMm_2001
t_SMfm_2001 = np.sum(df_st_SM_2001.where(df_st_SM_2001["Gender"]=="Female")["Total"])
t_SMfm_2001
t_TNm_2001 = np.sum(df_st_TN_2001.where(df_st_TN_2001["Gender"]=="Male")["Total"])
t_TNm_2001
t_TNfm_2001 = np.sum(df_st_TN_2001.where(df_st_TN_2001["Gender"]=="Female")["Total"])
t_TNfm_2001
t_TPm_2001 = np.sum(df_st_TP_2001.where(df_st_TP_2001["Gender"]=="Male")["Total"])
t_TPm_2001
t_TPfm_2001 = np.sum(df_st_TP_2001.where(df_st_TP_2001["Gender"]=="Female")["Total"])
t_TPfm_2001
t_UPm_2001 = np.sum(df_st_UP_2001.where(df_st_UP_2001["Gender"]=="Male")["Total"])
t_UPm_2001
t_UPfm_2001 = np.sum(df_st_UP_2001.where(df_st_UP_2001["Gender"]=="Female")["Total"])
t_UPfm_2001
t_UKm_2001 = np.sum(df_st_UK_2001.where(df_st_UK_2001["Gender"]=="Male")["Total"])
t_UKm_2001
t_UKfm_2001 = np.sum(df_st_UK_2001.where(df_st_UK_2001["Gender"]=="Female")["Total"])
t_UKfm_2001
t_WBm_2001 = np.sum(df_st_WB_2001.where(df_st_WB_2001["Gender"]=="Male")["Total"])
t_WBm_2001
t_WBfm_2001 = np.sum(df_st_WB_2001.where(df_st_WB_2001["Gender"]=="Female")["Total"])
t_WBfm_2001
l_2001=list(df_2001.loc[:,"Type"].unique())
l_2001.sort()
print(l_2001,end=" ")
cause_l_2001=[]
for i in l_2001:
rough= np.sum(df_2001.where(df_2001["Type"]==i)["Total"])
cause_l_2001.append(rough)
print(cause_l_2001,end=" ")
x1_2001 = set(df_2001.loc[:,"State"])
x1_2001
len(x1_2001)
cause_df_2001 = pd.DataFrame(cause_l_2001,l_2001)
cause_df_2001.reset_index()
cause_df_2001.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2001",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2001=list(df_2001.loc[:,"State"].unique())
s_2001.sort()
print(s_2001,end=" ")
state_s_2001 = [s1_19,s1_20,s1_21,s1_22,s1_23,s1_24,s1_25,s1_26,s1_27,s1_28,s1_29,s1_30,s1_31,s1_32,s1_33,s1_34,
s1_35,s1_36,s1_37,s1_38,s1_39,s1_40,s1_41,s1_42,s1_43,s1_44,s1_45,s1_46,s1_47,s1_48,s1_49,s1_50,
s1_51,s1_52,s1_53]
print(state_s_2001,end=" ")
state_m_2001=[t_ANm_2001, t_APm_2001, t_ARPm_2001, t_ASm_2001, t_BHm_2001, t_CHm_2001, t_CTm_2001, t_DNm_2001,
t_DDm_2001, t_DLm_2001, t_GOAm_2001, t_GJm_2001, t_HRm_2001, t_HPm_2001,t_JKm_2001, t_JHm_2001,
t_KNm_2001, t_KERm_2001, t_LDm_2001,t_MPm_2001,t_MHm_2001,t_MNm_2001,t_MGm_2001,t_MZm_2001,
t_NGm_2001, t_ODm_2001, t_PDm_2001,t_PBm_2001,t_RJm_2001,t_SMm_2001,t_TNm_2001,t_TPm_2001,
t_UPm_2001, t_UKm_2001, t_WBm_2001]
print(state_m_2001,end=" ")
state_fm_2001=[t_ANfm_2001, t_APfm_2001, t_ARPfm_2001, t_ASfm_2001, t_BHfm_2001, t_CHfm_2001, t_CTfm_2001, t_DNfm_2001,
t_DDfm_2001, t_DLfm_2001, t_GOAfm_2001, t_GJfm_2001, t_HRfm_2001, t_HPfm_2001,t_JKfm_2001, t_JHfm_2001,
t_KNfm_2001, t_KERfm_2001, t_LDfm_2001,t_MPfm_2001,t_MHfm_2001,t_MNfm_2001,t_MGfm_2001,t_MZfm_2001,
t_NGfm_2001, t_ODfm_2001, t_PDfm_2001,t_PBfm_2001,t_RJfm_2001,t_SMfm_2001,t_TNfm_2001,t_TPfm_2001,
t_UPfm_2001, t_UKfm_2001, t_WBfm_2001]
print(state_fm_2001,end=" ")
df_state_2001 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s1_19,s1_20,s1_21,s1_22,s1_23,s1_24,s1_25,s1_26,s1_27,s1_28,s1_29,s1_30,s1_31,s1_32,s1_33,s1_34,
s1_35,s1_36,s1_37,s1_38,s1_39,s1_40,s1_41,s1_42,s1_43,s1_44,s1_45,s1_46,s1_47,s1_48,s1_49,s1_50,
s1_51,s1_52,s1_53],
"Male":[t_ANm_2001, t_APm_2001, t_ARPm_2001, t_ASm_2001, t_BHm_2001, t_CHm_2001, t_CTm_2001, t_DNm_2001,
t_DDm_2001, t_DLm_2001, t_GOAm_2001, t_GJm_2001, t_HRm_2001, t_HPm_2001,t_JKm_2001, t_JHm_2001,
t_KNm_2001, t_KERm_2001, t_LDm_2001,t_MPm_2001,t_MHm_2001,t_MNm_2001,t_MGm_2001,t_MZm_2001,
t_NGm_2001, t_ODm_2001, t_PDm_2001,t_PBm_2001,t_RJm_2001,t_SMm_2001,t_TNm_2001,t_TPm_2001,
t_UPm_2001, t_UKm_2001, t_WBm_2001],
"Female":[t_ANfm_2001, t_APfm_2001, t_ARPfm_2001, t_ASfm_2001, t_BHfm_2001, t_CHfm_2001, t_CTfm_2001, t_DNfm_2001,
t_DDfm_2001, t_DLfm_2001, t_GOAfm_2001, t_GJfm_2001, t_HRfm_2001, t_HPfm_2001,t_JKfm_2001, t_JHfm_2001,
t_KNfm_2001, t_KERfm_2001, t_LDfm_2001,t_MPfm_2001,t_MHfm_2001,t_MNfm_2001,t_MGfm_2001,t_MZfm_2001,
t_NGfm_2001, t_ODfm_2001, t_PDfm_2001,t_PBfm_2001,t_RJfm_2001,t_SMfm_2001,t_TNfm_2001,t_TPfm_2001,
t_UPfm_2001, t_UKfm_2001, t_WBfm_2001]
}
df_All_st_2001 = pd.DataFrame(df_state_2001)
df_All_st_2001
pivot_2001 = pd.pivot_table(df_All_st_2001, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2001
pivot_2001.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2001=[]
for i in cause_l_2001:
p=i/np.sum(cause_l_2001)
avg_2001_cause=p*100
cause_l_percent_2001.append(avg_2001_cause)
print(cause_l_percent_2001,end=" ")
np.max(cause_l_percent_2001) #Married
np.min(cause_l_percent_2001) #Ideological Causes/Hero Worshipping
state_s_2001_percent=[]
tot=np.sum(state_s_2001)
for i in state_s_2001:
xy=i/tot
avg_state_2001=xy*100
state_s_2001_percent.append(avg_state_2001)
print(state_s_2001_percent,end=" ")
np.max(state_s_2001_percent) #Maharashtra
np.min(state_s_2001_percent) #Lakshdweep
l_age_grp_2001=[s1_4,s1_5,s1_6,s1_7,s1_8,s1_54]
l_age_grp_2001
l_age_grp_2001_percent=[]
for i in l_age_grp_2001:
yz=i/s1_1
avg_2001_age_grp=yz*100
l_age_grp_2001_percent.append(avg_2001_age_grp)
l_age_grp_2001_percent
np.max(l_age_grp_2001_percent) #0-100+
np.min(l_age_grp_2001_percent) #0-14
total_male_percent_2001= (s1_2/s1_1)*100
total_male_percent_2001
total_female_percent_2001= (s1_3/s1_1)*100
total_female_percent_2001
l_mage_2001 = [s1_9,s1_11,s1_13,s1_15,s1_17,s1_56] # male age group-wise deathcount
l_fmage_2001 = [s1_10,s1_12,s1_14,s1_16,s1_18,s1_55] # female age group-wise deathcount
l_mage_2001
l_fmage_2001
age_m_pnt_2001 = [] #percentage of death count of each male age group
for i in l_mage_2001:
r1_2001= i/s1_2
r1_2001=r1_2001*100
age_m_pnt_2001.append(r1_2001)
age_m_pnt_2001 # 2nd highest - 30-44
age_fm_pnt_2001 = [] #percentage of death count of each female age group
for i in l_fmage_2001:
r2_2001= i/s1_3
r2_2001=r2_2001*100
age_fm_pnt_2001.append(r2_2001)
age_fm_pnt_2001 # 2nd highest - 15-29
df_2002 = suicide_df.loc[(suicide_df["Year"]==2002)]
df_2002
t2002_dcount = df_2002.loc[:,"Total"]
s2_1 = np.sum(t2002_dcount)
s2_1
male_2002 = df_2002.loc[(df_2002["Gender"]=="Male")]
male_2002
m2002_count = male_2002.loc[:,"Total"]
s2_2 = np.sum(m2002_count)
s2_2
female_2002 = df_2002.loc[(df_2002["Gender"]=="Female")]
female_2002
fm2002_count = female_2002.loc[:,"Total"]
s2_3 = np.sum(fm2002_count)
s2_3
df_age_d014_2002 = df_2002.loc[(df_2002["Age_group"]=="0-14")]
df_age_d014_2002
t_014_2002 = df_age_d014_2002.loc[:,"Total"]
s2_4 = np.sum(t_014_2002)
s2_4
df_age_d1529_2002 = df_2002.loc[(df_2002["Age_group"]=="15-29")]
df_age_d1529_2002
t_1529_2002 = df_age_d1529_2002.loc[:,"Total"]
s2_5 = np.sum(t_1529_2002)
s2_5
df_age_d3044_2002 = df_2002.loc[(df_2002["Age_group"]=="30-44")]
df_age_d3044_2002
t_3044_2002 = df_age_d3044_2002.loc[:,"Total"]
s2_6 = np.sum(t_3044_2002)
s2_6
df_age_d4559_2002 = df_2002.loc[(df_2002["Age_group"]=="45-59")]
df_age_d4559_2002
t_4559_2002 = df_age_d4559_2002.loc[:,"Total"]
s2_7 = np.sum(t_4559_2002)
s2_7
df_age_d60_2002 = df_2002.loc[(df_2002["Age_group"]=="60+")]
df_age_d60_2002
t_60_2002 = df_age_d60_2002.loc[:,"Total"]
s2_8 = np.sum(t_60_2002)
s2_8
df_age_d0100_2002 = df_2002.loc[(df_2002["Age_group"]=="0-100+")]
df_age_d0100_2002
t_0100_2002 = df_age_d0100_2002.loc[:,"Total"]
s2_54 = np.sum(t_0100_2002)
s2_54
df_014m_2002 = df_age_d014_2002.loc[(df_age_d014_2002["Gender"]=="Male")]
df_014m_2002
t_014m_2002 = df_014m_2002.loc[:,"Total"]
s2_9 = np.sum(t_014m_2002)
s2_9
df_014fm_2002 = df_age_d014_2002.loc[(df_age_d014_2002["Gender"]=="Female")]
df_014fm_2002
t_014fm_2002 = df_014fm_2002.loc[:,"Total"]
s2_10 = np.sum(t_014fm_2002)
s2_10
df_1529m_2002 = df_age_d1529_2002.loc[(df_age_d1529_2002["Gender"]=="Male")]
df_1529m_2002
t_1529m_2002 = df_1529m_2002.loc[:,"Total"]
s2_11 = np.sum(t_1529m_2002)
s2_11
df_1529fm_2002 = df_age_d1529_2002.loc[(df_age_d1529_2002["Gender"]=="Female")]
df_1529fm_2002
t_1529fm_2002 = df_1529fm_2002.loc[:,"Total"]
s2_12 = np.sum(t_1529fm_2002)
s2_12
df_3044m_2002 = df_age_d3044_2002.loc[(df_age_d3044_2002["Gender"]=="Male")]
df_3044m_2002
t_3044m_2002 = df_3044m_2002.loc[:,"Total"]
s2_13 = np.sum(t_3044m_2002)
s2_13
df_3044fm_2002 = df_age_d3044_2002.loc[(df_age_d3044_2002["Gender"]=="Female")]
df_3044fm_2002
t_3044fm_2002 = df_3044fm_2002.loc[:,"Total"]
s2_14 = np.sum(t_3044fm_2002)
s2_14
df_4559m_2002 = df_age_d4559_2002.loc[(df_age_d4559_2002["Gender"]=="Male")]
df_4559m_2002
t_4559m_2002 = df_4559m_2002.loc[:,"Total"]
s2_15 = np.sum(t_4559m_2002)
s2_15
df_4559fm_2002 = df_age_d4559_2002.loc[(df_age_d4559_2002["Gender"]=="Female")]
df_4559fm_2002
t_4559fm_2002 = df_4559fm_2002.loc[:,"Total"]
s2_16 = np.sum(t_4559fm_2002)
s2_16
df_60m_2002 = df_age_d60_2002.loc[(df_age_d60_2002["Gender"]=="Male")]
df_60m_2002
t_60m_2002 = df_60m_2002.loc[:,"Total"]
s2_17 = np.sum(t_60m_2002)
s2_17
df_60fm_2002 = df_age_d60_2002.loc[(df_age_d60_2002["Gender"]=="Female")]
df_60fm_2002
t_60fm_2002 = df_60fm_2002.loc[:,"Total"]
s2_18 = np.sum(t_60fm_2002)
s2_18
df_0100fm_2002 = df_age_d0100_2002.loc[(df_age_d0100_2002["Gender"]=="Female")]
df_0100fm_2002
t_0100fm_2002 = df_0100fm_2002.loc[:,"Total"]
s2_55 = np.sum(t_0100fm_2002)
s2_55
df_0100m_2002 = df_age_d0100_2002.loc[(df_age_d0100_2002["Gender"]=="Male")]
df_0100m_2002
t_0100m_2002 = df_0100m_2002.loc[:,"Total"]
s2_56 = np.sum(t_0100m_2002)
s2_56
df_st_AN_2002 = df_2002.loc[(df_2002["State"]=="A & N ISLANDS")]
df_st_AN_2002
t_AN_2002 = df_st_AN_2002.loc[:,"Total"]
s2_19 = np.sum(t_AN_2002)
s2_19
df_st_AP_2002 = df_2002.loc[(df_2002["State"]=="ANDHRA PRADESH")]
df_st_AP_2002
t_AP_2002 = df_st_AP_2002.loc[:,"Total"]
s2_20 = np.sum(t_AP_2002)
s2_20
df_st_ARP_2002 = df_2002.loc[(df_2002["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2002
t_ARP_2002 = df_st_ARP_2002.loc[:,"Total"]
s2_21 = np.sum(t_ARP_2002)
s2_21
df_st_AS_2002 = df_2002.loc[(df_2002["State"]=="ASSAM")]
df_st_AS_2002
t_AS_2002 = df_st_AS_2002.loc[:,"Total"]
s2_22 = np.sum(t_AS_2002)
s2_22
df_st_BH_2002 = df_2002.loc[(df_2002["State"]=="BIHAR")]
df_st_BH_2002
t_BH_2002 = df_st_BH_2002.loc[:,"Total"]
s2_23 = np.sum(t_BH_2002)
s2_23
df_st_CH_2002 = df_2002.loc[(df_2002["State"]=="CHANDIGARH")]
df_st_CH_2002
t_CH_2002 = df_st_CH_2002.loc[:,"Total"]
s2_24 = np.sum(t_CH_2002)
s2_24
df_st_CT_2002 = df_2002.loc[(df_2002["State"]=="CHHATTISGARH")]
df_st_CT_2002
t_CT_2002 = df_st_CT_2002.loc[:,"Total"]
s2_25 = np.sum(t_CT_2002)
s2_25
df_st_DN_2002 = df_2002.loc[(df_2002["State"]=="D & N HAVELI")]
df_st_DN_2002
t_DN_2002 = df_st_DN_2002.loc[:,"Total"]
s2_26 = np.sum(t_DN_2002)
s2_26
df_st_DD_2002 = df_2002.loc[(df_2002["State"]=="DAMAN & DIU")]
df_st_DD_2002
t_DD_2002 = df_st_DD_2002.loc[:,"Total"]
s2_27 = np.sum(t_DD_2002)
s2_27
df_st_DL_2002 = df_2002.loc[(df_2002["State"]=="DELHI (UT)")]
df_st_DL_2002
t_DL_2002 = df_st_DL_2002.loc[:,"Total"]
s2_28 = np.sum(t_DL_2002)
s2_28
df_st_GOA_2002 = df_2002.loc[(df_2002["State"]=="GOA")]
df_st_GOA_2002
t_GOA_2002 = df_st_GOA_2002.loc[:,"Total"]
s2_29 = np.sum(t_GOA_2002)
s2_29
df_st_GJ_2002 = df_2002.loc[(df_2002["State"]=="GUJARAT")]
df_st_GJ_2002
t_GJ_2002 = df_st_GJ_2002.loc[:,"Total"]
s2_30 = np.sum(t_GJ_2002)
s2_30
df_st_HR_2002 = df_2002.loc[(df_2002["State"]=="HARYANA")]
df_st_HR_2002
t_HR_2002 = df_st_HR_2002.loc[:,"Total"]
s2_31 = np.sum(t_HR_2002)
s2_31
df_st_HP_2002 = df_2002.loc[(df_2002["State"]=="HIMACHAL PRADESH")]
df_st_HP_2002
t_HP_2002 = df_st_HP_2002.loc[:,"Total"]
s2_32 = np.sum(t_HP_2002)
s2_32
df_st_JK_2002 = df_2002.loc[(df_2002["State"]=="JAMMU & KASHMIR")]
df_st_JK_2002
t_JK_2002 = df_st_JK_2002.loc[:,"Total"]
s2_33 = np.sum(t_JK_2002)
s2_33
df_st_JH_2002 = df_2002.loc[(df_2002["State"]=="JHARKHAND")]
df_st_JH_2002
t_JH_2002 = df_st_JH_2002.loc[:,"Total"]
s2_34 = np.sum(t_JH_2002)
s2_34
df_st_KN_2002 = df_2002.loc[(df_2002["State"]=="KARNATAKA")]
df_st_KN_2002
t_KN_2002 = df_st_KN_2002.loc[:,"Total"]
s2_35 = np.sum(t_KN_2002)
s2_35
df_st_KER_2002 = df_2002.loc[(df_2002["State"]=="KERALA")]
df_st_KER_2002
t_KER_2002 = df_st_KER_2002.loc[:,"Total"]
s2_36 = np.sum(t_KER_2002)
s2_36
df_st_LD_2002 = df_2002.loc[(df_2002["State"]=="LAKSHADWEEP")]
df_st_LD_2002
t_LD_2002 = df_st_LD_2002.loc[:,"Total"]
s2_37 = np.sum(t_LD_2002)
s2_37
df_st_MP_2002 = df_2002.loc[(df_2002["State"]=="MADHYA PRADESH")]
df_st_MP_2002
t_MP_2002 = df_st_MP_2002.loc[:,"Total"]
s2_38 = np.sum(t_MP_2002)
s2_38
df_st_MH_2002 = df_2002.loc[(df_2002["State"]=="MAHARASHTRA")]
df_st_MH_2002
t_MH_2002 = df_st_MH_2002.loc[:,"Total"]
s2_39 = np.sum(t_MH_2002)
s2_39
df_st_MN_2002 = df_2002.loc[(df_2002["State"]=="MANIPUR")]
df_st_MN_2002
t_MN_2002 = df_st_MN_2002.loc[:,"Total"]
s2_40 = np.sum(t_MN_2002)
s2_40
df_st_MG_2002 = df_2002.loc[(df_2002["State"]=="MEGHALAYA")]
df_st_MG_2002
t_MG_2002 = df_st_MG_2002.loc[:,"Total"]
s2_41 = np.sum(t_MG_2002)
s2_41
df_st_MZ_2002 = df_2002.loc[(df_2002["State"]=="MIZORAM")]
df_st_MZ_2002
t_MN_2002 = df_st_MN_2002.loc[:,"Total"]
s2_42 = np.sum(t_MN_2002)
s2_42
df_st_NG_2002 = df_2002.loc[(df_2002["State"]=="NAGALAND")]
df_st_NG_2002
t_NG_2002 = df_st_NG_2002.loc[:,"Total"]
s2_43 = np.sum(t_NG_2002)
s2_43
df_st_OD_2002 = df_2002.loc[(df_2002["State"]=="ODISHA")]
df_st_OD_2002
t_OD_2002 = df_st_OD_2002.loc[:,"Total"]
s2_44 = np.sum(t_OD_2002)
s2_44
df_st_PD_2002 = df_2002.loc[(df_2002["State"]=="PUDUCHERRY")]
df_st_PD_2002
t_PD_2002 = df_st_PD_2002.loc[:,"Total"]
s2_45 = np.sum(t_PD_2002)
s2_45
df_st_PB_2002 = df_2002.loc[(df_2002["State"]=="PUNJAB")]
df_st_PB_2002
t_PB_2002 = df_st_PB_2002.loc[:,"Total"]
s2_46 = np.sum(t_PB_2002)
s2_46
df_st_RJ_2002 = df_2002.loc[(df_2002["State"]=="RAJASTHAN")]
df_st_RJ_2002
t_RJ_2002 = df_st_RJ_2002.loc[:,"Total"]
s2_47 = np.sum(t_RJ_2002)
s2_47
df_st_SM_2002 = df_2002.loc[(df_2002["State"]=="SIKKIM")]
df_st_SM_2002
t_SM_2002 = df_st_SM_2002.loc[:,"Total"]
s2_48 = np.sum(t_SM_2002)
s2_48
df_st_TN_2002 = df_2002.loc[(df_2002["State"]=="TAMIL NADU")]
df_st_TN_2002
t_TN_2002 = df_st_TN_2002.loc[:,"Total"]
s2_49 = np.sum(t_TN_2002)
s2_49
df_st_TP_2002 = df_2002.loc[(df_2002["State"]=="TRIPURA")]
df_st_TP_2002
t_TP_2002 = df_st_TP_2002.loc[:,"Total"]
s2_50 = np.sum(t_TP_2002)
s2_50
df_st_UP_2002 = df_2002.loc[(df_2002["State"]=="UTTAR PRADESH")]
df_st_UP_2002
t_UP_2002 = df_st_UP_2002.loc[:,"Total"]
s2_51 = np.sum(t_UP_2002)
s2_51
df_st_UK_2002 = df_2002.loc[(df_2002["State"]=="UTTARAKHAND")]
df_st_UK_2002
t_UK_2002 = df_st_UK_2002.loc[:,"Total"]
s2_52 = np.sum(t_UK_2002)
s2_52
df_st_WB_2002 = df_2002.loc[(df_2002["State"]=="WEST BENGAL")]
df_st_WB_2002
t_WB_2002 = df_st_WB_2002.loc[:,"Total"]
s2_53 = np.sum(t_WB_2002)
s2_53
t_ANm_2002 = np.sum(df_st_AN_2002.where(df_st_AN_2002["Gender"]=="Male")["Total"])
t_ANm_2002
t_ANfm_2002 = np.sum(df_st_AN_2002.where(df_st_AN_2002["Gender"]=="Female")["Total"])
t_ANfm_2002
t_APm_2002 = np.sum(df_st_AP_2002.where(df_st_AP_2002["Gender"]=="Male")["Total"])
t_APm_2002
t_APfm_2002 = np.sum(df_st_AP_2002.where(df_st_AP_2002["Gender"]=="Female")["Total"])
t_APfm_2002
t_ARPm_2002 = np.sum(df_st_ARP_2002.where(df_st_ARP_2002["Gender"]=="Male")["Total"])
t_ARPm_2002
t_ARPfm_2002 = np.sum(df_st_ARP_2002.where(df_st_ARP_2002["Gender"]=="Female")["Total"])
t_ARPfm_2002
t_ASm_2002 = np.sum(df_st_AS_2002.where(df_st_AS_2002["Gender"]=="Male")["Total"])
t_ASm_2002
t_ASfm_2002 = np.sum(df_st_AS_2002.where(df_st_AS_2002["Gender"]=="Female")["Total"])
t_ASfm_2002
t_BHm_2002 = np.sum(df_st_BH_2002.where(df_st_BH_2002["Gender"]=="Male")["Total"])
t_BHm_2002
t_BHfm_2002 = np.sum(df_st_BH_2002.where(df_st_BH_2002["Gender"]=="Female")["Total"])
t_BHfm_2002
t_CHm_2002 = np.sum(df_st_CH_2002.where(df_st_CH_2002["Gender"]=="Male")["Total"])
t_CHm_2002
t_CHfm_2002 = np.sum(df_st_CH_2002.where(df_st_CH_2002["Gender"]=="Female")["Total"])
t_CHfm_2002
t_CTm_2002 = np.sum(df_st_CT_2002.where(df_st_CT_2002["Gender"]=="Male")["Total"])
t_CTm_2002
t_CTfm_2002 = np.sum(df_st_CT_2002.where(df_st_CT_2002["Gender"]=="Female")["Total"])
t_CTfm_2002
t_DNm_2002 = np.sum(df_st_DN_2002.where(df_st_DN_2002["Gender"]=="Male")["Total"])
t_DNm_2002
t_DNfm_2002 = np.sum(df_st_DN_2002.where(df_st_DN_2002["Gender"]=="Female")["Total"])
t_DNfm_2002
t_DDm_2002 = np.sum(df_st_DD_2002.where(df_st_DD_2002["Gender"]=="Male")["Total"])
t_DDm_2002
t_DDfm_2002 = np.sum(df_st_DD_2002.where(df_st_DD_2002["Gender"]=="Female")["Total"])
t_DDfm_2002
t_DLm_2002 = np.sum(df_st_DL_2002.where(df_st_DL_2002["Gender"]=="Male")["Total"])
t_DLm_2002
t_DLfm_2002 = np.sum(df_st_DL_2002.where(df_st_DL_2002["Gender"]=="Female")["Total"])
t_DLfm_2002
t_GOAm_2002 = np.sum(df_st_GOA_2002.where(df_st_GOA_2002["Gender"]=="Male")["Total"])
t_GOAm_2002
t_GOAfm_2002 = np.sum(df_st_GOA_2002.where(df_st_GOA_2002["Gender"]=="Female")["Total"])
t_GOAfm_2002
t_GJm_2002 = np.sum(df_st_GJ_2002.where(df_st_GJ_2002["Gender"]=="Male")["Total"])
t_GJm_2002
t_GJfm_2002 = np.sum(df_st_GJ_2002.where(df_st_GJ_2002["Gender"]=="Female")["Total"])
t_GJfm_2002
t_HRm_2002 = np.sum(df_st_HR_2002.where(df_st_HR_2002["Gender"]=="Male")["Total"])
t_HRm_2002
t_HRfm_2002 = np.sum(df_st_HR_2002.where(df_st_HR_2002["Gender"]=="Female")["Total"])
t_HRfm_2002
t_HPm_2002 = np.sum(df_st_HP_2002.where(df_st_HP_2002["Gender"]=="Male")["Total"])
t_HPm_2002
t_HPfm_2002 = np.sum(df_st_HP_2002.where(df_st_HP_2002["Gender"]=="Female")["Total"])
t_HPfm_2002
t_JKm_2002 = np.sum(df_st_JK_2002.where(df_st_JK_2002["Gender"]=="Male")["Total"])
t_JKm_2002
t_JKfm_2002 = np.sum(df_st_JK_2002.where(df_st_JK_2002["Gender"]=="Female")["Total"])
t_JKfm_2002
t_JHm_2002 = np.sum(df_st_JH_2002.where(df_st_JH_2002["Gender"]=="Male")["Total"])
t_JHm_2002
t_JHfm_2002 = np.sum(df_st_JH_2002.where(df_st_JH_2002["Gender"]=="Female")["Total"])
t_JHfm_2002
t_KNm_2002 = np.sum(df_st_KN_2002.where(df_st_KN_2002["Gender"]=="Male")["Total"])
t_KNm_2002
t_KNfm_2002 = np.sum(df_st_KN_2002.where(df_st_KN_2002["Gender"]=="Female")["Total"])
t_KNfm_2002
t_KERm_2002 = np.sum(df_st_KER_2002.where(df_st_KER_2002["Gender"]=="Male")["Total"])
t_KERm_2002
t_KERfm_2002 = np.sum(df_st_KER_2002.where(df_st_KER_2002["Gender"]=="Female")["Total"])
t_KERfm_2002
t_LDm_2002 = np.sum(df_st_LD_2002.where(df_st_LD_2002["Gender"]=="Male")["Total"])
t_LDm_2002
t_LDfm_2002 = np.sum(df_st_LD_2002.where(df_st_LD_2002["Gender"]=="Female")["Total"])
t_LDfm_2002
t_MPm_2002 = np.sum(df_st_MP_2002.where(df_st_MP_2002["Gender"]=="Male")["Total"])
t_MPm_2002
t_MPfm_2002 = np.sum(df_st_MP_2002.where(df_st_MP_2002["Gender"]=="Female")["Total"])
t_MPfm_2002
t_MHm_2002 = np.sum(df_st_MH_2002.where(df_st_MH_2002["Gender"]=="Male")["Total"])
t_MHm_2002
t_MHfm_2002 = np.sum(df_st_MH_2002.where(df_st_MH_2002["Gender"]=="Female")["Total"])
t_MHfm_2002
t_MNm_2002 = np.sum(df_st_MN_2002.where(df_st_MN_2002["Gender"]=="Male")["Total"])
t_MNm_2002
t_MNfm_2002 = np.sum(df_st_MN_2002.where(df_st_MN_2002["Gender"]=="Female")["Total"])
t_MNfm_2002
t_MGm_2002 = np.sum(df_st_MG_2002.where(df_st_MG_2002["Gender"]=="Male")["Total"])
t_MGm_2002
t_MGfm_2002 = np.sum(df_st_MG_2002.where(df_st_MG_2002["Gender"]=="Female")["Total"])
t_MGfm_2002
t_MZm_2002 = np.sum(df_st_MZ_2002.where(df_st_MZ_2002["Gender"]=="Male")["Total"])
t_MZm_2002
t_MZfm_2002 = np.sum(df_st_MZ_2002.where(df_st_MZ_2002["Gender"]=="Female")["Total"])
t_MZfm_2002
t_NGm_2002 = np.sum(df_st_NG_2002.where(df_st_NG_2002["Gender"]=="Male")["Total"])
t_NGm_2002
t_NGfm_2002 = np.sum(df_st_NG_2002.where(df_st_NG_2002["Gender"]=="Female")["Total"])
t_MGfm_2002
t_ODm_2002 = np.sum(df_st_OD_2002.where(df_st_OD_2002["Gender"]=="Male")["Total"])
t_ODm_2002
t_ODfm_2002 = np.sum(df_st_OD_2002.where(df_st_OD_2002["Gender"]=="Female")["Total"])
t_ODfm_2002
t_PDm_2002 = np.sum(df_st_PD_2002.where(df_st_PD_2002["Gender"]=="Male")["Total"])
t_PDm_2002
t_PDfm_2002 = np.sum(df_st_PD_2002.where(df_st_PD_2002["Gender"]=="Female")["Total"])
t_PDfm_2002
t_PBm_2002 = np.sum(df_st_PB_2002.where(df_st_PB_2002["Gender"]=="Male")["Total"])
t_PBm_2002
t_PBfm_2002 = np.sum(df_st_PB_2002.where(df_st_PB_2002["Gender"]=="Female")["Total"])
t_PBfm_2002
t_RJm_2002 = np.sum(df_st_RJ_2002.where(df_st_RJ_2002["Gender"]=="Male")["Total"])
t_RJm_2002
t_RJfm_2002 = np.sum(df_st_RJ_2002.where(df_st_RJ_2002["Gender"]=="Female")["Total"])
t_RJfm_2002
t_SMm_2002 = np.sum(df_st_SM_2002.where(df_st_SM_2002["Gender"]=="Male")["Total"])
t_SMm_2002
t_SMfm_2002 = np.sum(df_st_SM_2002.where(df_st_SM_2002["Gender"]=="Female")["Total"])
t_SMfm_2002
t_TNm_2002 = np.sum(df_st_TN_2002.where(df_st_TN_2002["Gender"]=="Male")["Total"])
t_TNm_2002
t_TNfm_2002 = np.sum(df_st_TN_2002.where(df_st_TN_2002["Gender"]=="Female")["Total"])
t_TNfm_2002
t_TPm_2002 = np.sum(df_st_TP_2002.where(df_st_TP_2002["Gender"]=="Male")["Total"])
t_TPm_2002
t_TPfm_2002 = np.sum(df_st_TP_2002.where(df_st_TP_2002["Gender"]=="Female")["Total"])
t_TPfm_2002
t_UPm_2002 = np.sum(df_st_UP_2002.where(df_st_UP_2002["Gender"]=="Male")["Total"])
t_UPm_2002
t_UPfm_2002 = np.sum(df_st_UP_2002.where(df_st_UP_2002["Gender"]=="Female")["Total"])
t_UPfm_2002
t_UKm_2002 = np.sum(df_st_UK_2002.where(df_st_UK_2002["Gender"]=="Male")["Total"])
t_UKm_2002
t_UKfm_2002 = np.sum(df_st_UK_2002.where(df_st_UK_2002["Gender"]=="Female")["Total"])
t_UKfm_2002
t_WBm_2002 = np.sum(df_st_WB_2002.where(df_st_WB_2002["Gender"]=="Male")["Total"])
t_WBm_2002
t_WBfm_2002 = np.sum(df_st_WB_2002.where(df_st_WB_2002["Gender"]=="Female")["Total"])
t_WBfm_2002
l_2002=list(df_2002.loc[:,"Type"].unique())
l_2002.sort()
print(l_2002,end=" ")
cause_l_2002=[]
for i in l_2002:
rough= np.sum(df_2002.where(df_2002["Type"]==i)["Total"])
cause_l_2002.append(rough)
print(cause_l_2002,end=" ")
x1_2002 = set(df_2002.loc[:,"State"])
x1_2002
len(x1_2002)
cause_df_2002 = pd.DataFrame(cause_l_2002,l_2002)
cause_df_2002.reset_index()
cause_df_2002.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2002",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2002=list(df_2002.loc[:,"State"].unique())
s_2002.sort()
print(s_2002,end=" ")
state_s_2002 = [s2_19,s2_20,s2_21,s2_22,s2_23,s2_24,s2_25,s2_26,s2_27,s2_28,s2_29,s2_30,s2_31,s2_32,s2_33,s2_34,
s2_35,s2_36,s2_37,s2_38,s2_39,s2_40,s2_41,s2_42,s2_43,s2_44,s2_45,s2_46,s2_47,s2_48,s2_49,s2_50,
s2_51,s2_52,s2_53]
print(state_s_2002,end=" ")
state_m_2002=[t_ANm_2002, t_APm_2002, t_ARPm_2002, t_ASm_2002, t_BHm_2002, t_CHm_2002, t_CTm_2002, t_DNm_2002,
t_DDm_2002, t_DLm_2002, t_GOAm_2002, t_GJm_2002, t_HRm_2002, t_HPm_2002,t_JKm_2002, t_JHm_2002,
t_KNm_2002, t_KERm_2002, t_LDm_2002,t_MPm_2002,t_MHm_2002,t_MNm_2002,t_MGm_2002,t_MZm_2002,
t_NGm_2002, t_ODm_2002, t_PDm_2002,t_PBm_2002,t_RJm_2002,t_SMm_2002,t_TNm_2002,t_TPm_2002,
t_UPm_2002, t_UKm_2002, t_WBm_2002]
print(state_m_2002,end=" ")
state_fm_2002=[t_ANfm_2002, t_APfm_2002, t_ARPfm_2002, t_ASfm_2002, t_BHfm_2002, t_CHfm_2002, t_CTfm_2002, t_DNfm_2002,
t_DDfm_2002, t_DLfm_2002, t_GOAfm_2002, t_GJfm_2002, t_HRfm_2002, t_HPfm_2002,t_JKfm_2002, t_JHfm_2002,
t_KNfm_2002, t_KERfm_2002, t_LDfm_2002,t_MPfm_2002,t_MHfm_2002,t_MNfm_2002,t_MGfm_2002,t_MZfm_2002,
t_NGfm_2002, t_ODfm_2002, t_PDfm_2002,t_PBfm_2002,t_RJfm_2002,t_SMfm_2002,t_TNfm_2002,t_TPfm_2002,
t_UPfm_2002, t_UKfm_2002, t_WBfm_2002]
print(state_fm_2002,end=" ")
df_state_2002 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s2_19,s2_20,s2_21,s2_22,s2_23,s2_24,s2_25,s2_26,s2_27,s2_28,s2_29,s2_30,s2_31,s2_32,s2_33,s2_34,
s2_35,s2_36,s2_37,s2_38,s2_39,s2_40,s2_41,s2_42,s2_43,s2_44,s2_45,s2_46,s2_47,s2_48,s2_49,s2_50,
s2_51,s2_52,s2_53],
"Male":[t_ANm_2002, t_APm_2002, t_ARPm_2002, t_ASm_2002, t_BHm_2002, t_CHm_2002, t_CTm_2002, t_DNm_2002,
t_DDm_2002, t_DLm_2002, t_GOAm_2002, t_GJm_2002, t_HRm_2002, t_HPm_2002,t_JKm_2002, t_JHm_2002,
t_KNm_2002, t_KERm_2002, t_LDm_2002,t_MPm_2002,t_MHm_2002,t_MNm_2002,t_MGm_2002,t_MZm_2002,
t_NGm_2002, t_ODm_2002, t_PDm_2002,t_PBm_2002,t_RJm_2002,t_SMm_2002,t_TNm_2002,t_TPm_2002,
t_UPm_2002, t_UKm_2002, t_WBm_2002],
"Female":[t_ANfm_2002, t_APfm_2002, t_ARPfm_2002, t_ASfm_2002, t_BHfm_2002, t_CHfm_2002, t_CTfm_2002, t_DNfm_2002,
t_DDfm_2002, t_DLfm_2002, t_GOAfm_2002, t_GJfm_2002, t_HRfm_2002, t_HPfm_2002,t_JKfm_2002, t_JHfm_2002,
t_KNfm_2002, t_KERfm_2002, t_LDfm_2002,t_MPfm_2002,t_MHfm_2002,t_MNfm_2002,t_MGfm_2002,t_MZfm_2002,
t_NGfm_2002, t_ODfm_2002, t_PDfm_2002,t_PBfm_2002,t_RJfm_2002,t_SMfm_2002,t_TNfm_2002,t_TPfm_2002,
t_UPfm_2002, t_UKfm_2002, t_WBfm_2002]
}
df_All_st_2002 = pd.DataFrame(df_state_2002)
df_All_st_2002
pivot_2002 = pd.pivot_table(df_All_st_2002, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2002
pivot_2002.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2002=[]
for i in cause_l_2002:
p=i/np.sum(cause_l_2002)
avg_2002_cause=p*100
cause_l_percent_2002.append(avg_2002_cause)
print(cause_l_percent_2002,end=" ")
np.max(cause_l_percent_2002) #Married
np.min(cause_l_percent_2002) #Ideological Causes/Hero Worshipping
state_s_2002_percent=[]
tot=np.sum(state_s_2002)
for i in state_s_2002:
xy=i/tot
avg_state_2002=xy*100
state_s_2002_percent.append(avg_state_2002)
print(state_s_2002_percent,end=" ")
np.max(state_s_2002_percent) #Maharashtra
np.min(state_s_2002_percent) #Lakshdweep
l_age_grp_2002=[s2_4,s2_5,s2_6,s2_7,s2_8,s2_54]
l_age_grp_2002
l_age_grp_2002_percent=[]
for i in l_age_grp_2002:
yz=i/s2_1
avg_2002_age_grp=yz*100
l_age_grp_2002_percent.append(avg_2002_age_grp)
l_age_grp_2002_percent
np.max(l_age_grp_2002_percent) #0-100+
np.min(l_age_grp_2002_percent) #0-14
total_male_percent_2002= (s2_2/s2_1)*100
total_male_percent_2002
total_female_percent_2002= (s2_3/s2_1)*100
total_female_percent_2002
df_2003 = suicide_df.loc[(suicide_df["Year"]==2003)]
df_2003
t2003_dcount = df_2003.loc[:,"Total"]
s3_1 = np.sum(t2003_dcount)
s3_1
male_2003 = df_2003.loc[(df_2003["Gender"]=="Male")]
male_2003
m2003_count = male_2003.loc[:,"Total"]
s3_2 = np.sum(m2003_count)
s3_2
female_2003 = df_2003.loc[(df_2003["Gender"]=="Female")]
female_2003
fm2003_count = female_2003.loc[:,"Total"]
s3_3 = np.sum(fm2003_count)
s3_3
df_age_d014_2003 = df_2003.loc[(df_2003["Age_group"]=="0-14")]
df_age_d014_2003
t_014_2003 = df_age_d014_2003.loc[:,"Total"]
s3_4 = np.sum(t_014_2003)
s3_4
df_age_d1529_2003 = df_2003.loc[(df_2003["Age_group"]=="15-29")]
df_age_d1529_2003
t_1529_2003 = df_age_d1529_2003.loc[:,"Total"]
s3_5 = np.sum(t_1529_2003)
s3_5
df_age_d3044_2003 = df_2003.loc[(df_2003["Age_group"]=="30-44")]
df_age_d3044_2003
t_3044_2003 = df_age_d3044_2003.loc[:,"Total"]
s3_6 = np.sum(t_3044_2003)
s3_6
df_age_d4559_2003 = df_2003.loc[(df_2003["Age_group"]=="45-59")]
df_age_d4559_2003
t_4559_2003 = df_age_d4559_2003.loc[:,"Total"]
s3_7 = np.sum(t_4559_2003)
s3_7
df_age_d60_2003 = df_2003.loc[(df_2003["Age_group"]=="60+")]
df_age_d60_2003
t_60_2003 = df_age_d60_2003.loc[:,"Total"]
s3_8 = np.sum(t_60_2003)
s3_8
df_age_d0100_2003 = df_2003.loc[(df_2003["Age_group"]=="0-100+")]
df_age_d0100_2003
t_0100_2003 = df_age_d0100_2003.loc[:,"Total"]
s3_54 = np.sum(t_0100_2003)
s3_54
df_014m_2003 = df_age_d014_2003.loc[(df_age_d014_2003["Gender"]=="Male")]
df_014m_2003
t_014m_2003 = df_014m_2003.loc[:,"Total"]
s3_9 = np.sum(t_014m_2003)
s3_9
df_014fm_2003 = df_age_d014_2003.loc[(df_age_d014_2003["Gender"]=="Female")]
df_014fm_2003
t_014fm_2003 = df_014fm_2003.loc[:,"Total"]
s3_10 = np.sum(t_014fm_2003)
s3_10
df_1529m_2003 = df_age_d1529_2003.loc[(df_age_d1529_2003["Gender"]=="Male")]
df_1529m_2003
t_1529m_2003 = df_1529m_2003.loc[:,"Total"]
s3_11 = np.sum(t_1529m_2003)
s3_11
df_1529fm_2003 = df_age_d1529_2003.loc[(df_age_d1529_2003["Gender"]=="Female")]
df_1529fm_2003
t_1529fm_2003 = df_1529fm_2003.loc[:,"Total"]
s3_12 = np.sum(t_1529fm_2003)
s3_12
df_3044m_2003 = df_age_d3044_2003.loc[(df_age_d3044_2003["Gender"]=="Male")]
df_3044m_2003
t_3044m_2003 = df_3044m_2003.loc[:,"Total"]
s3_13 = np.sum(t_3044m_2003)
s3_13
df_3044fm_2003 = df_age_d3044_2003.loc[(df_age_d3044_2003["Gender"]=="Female")]
df_3044fm_2003
t_3044fm_2003 = df_3044fm_2003.loc[:,"Total"]
s3_14 = np.sum(t_3044fm_2003)
s3_14
df_4559m_2003 = df_age_d4559_2003.loc[(df_age_d4559_2003["Gender"]=="Male")]
df_4559m_2003
t_4559m_2003 = df_4559m_2003.loc[:,"Total"]
s3_15 = np.sum(t_4559m_2003)
s3_15
df_4559fm_2003 = df_age_d4559_2003.loc[(df_age_d4559_2003["Gender"]=="Female")]
df_4559fm_2003
t_4559fm_2003 = df_4559fm_2003.loc[:,"Total"]
s3_16 = np.sum(t_4559fm_2003)
s3_16
df_60m_2003 = df_age_d60_2003.loc[(df_age_d60_2003["Gender"]=="Male")]
df_60m_2003
t_60m_2003 = df_60m_2003.loc[:,"Total"]
s3_17 = np.sum(t_60m_2003)
s3_17
df_60fm_2003 = df_age_d60_2003.loc[(df_age_d60_2003["Gender"]=="Female")]
df_60fm_2003
t_60fm_2003 = df_60fm_2003.loc[:,"Total"]
s3_18 = np.sum(t_60fm_2003)
s3_18
df_0100fm_2003 = df_age_d0100_2003.loc[(df_age_d0100_2003["Gender"]=="Female")]
df_0100fm_2003
t_0100fm_2003 = df_0100fm_2003.loc[:,"Total"]
s3_55 = np.sum(t_0100fm_2003)
s3_55
df_0100m_2003 = df_age_d0100_2003.loc[(df_age_d0100_2003["Gender"]=="Male")]
df_0100m_2003
t_0100m_2003 = df_0100m_2003.loc[:,"Total"]
s3_56 = np.sum(t_0100m_2003)
s3_56
df_st_AN_2003 = df_2003.loc[(df_2003["State"]=="A & N ISLANDS")]
df_st_AN_2003
t_AN_2003 = df_st_AN_2003.loc[:,"Total"]
s3_19 = np.sum(t_AN_2003)
s3_19
df_st_AP_2003 = df_2003.loc[(df_2003["State"]=="ANDHRA PRADESH")]
df_st_AP_2003
t_AP_2003 = df_st_AP_2003.loc[:,"Total"]
s3_20 = np.sum(t_AP_2003)
s3_20
df_st_ARP_2003 = df_2003.loc[(df_2003["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2003
t_ARP_2003 = df_st_ARP_2003.loc[:,"Total"]
s3_21 = np.sum(t_ARP_2003)
s3_21
df_st_AS_2003 = df_2003.loc[(df_2003["State"]=="ASSAM")]
df_st_AS_2003
t_AS_2003 = df_st_AS_2003.loc[:,"Total"]
s3_22 = np.sum(t_AS_2003)
s3_22
df_st_BH_2003 = df_2003.loc[(df_2003["State"]=="BIHAR")]
df_st_BH_2003
t_BH_2003 = df_st_BH_2003.loc[:,"Total"]
s3_23 = np.sum(t_BH_2003)
s3_23
df_st_CH_2003 = df_2003.loc[(df_2003["State"]=="CHANDIGARH")]
df_st_CH_2003
t_CH_2003 = df_st_CH_2003.loc[:,"Total"]
s3_24 = np.sum(t_CH_2003)
s3_24
df_st_CT_2003 = df_2003.loc[(df_2003["State"]=="CHHATTISGARH")]
df_st_CT_2003
t_CT_2003 = df_st_CT_2003.loc[:,"Total"]
s3_25 = np.sum(t_CT_2003)
s3_25
df_st_DN_2003 = df_2003.loc[(df_2003["State"]=="D & N HAVELI")]
df_st_DN_2003
t_DN_2003 = df_st_DN_2003.loc[:,"Total"]
s3_26 = np.sum(t_DN_2003)
s3_26
df_st_DD_2003 = df_2003.loc[(df_2003["State"]=="DAMAN & DIU")]
df_st_DD_2003
t_DD_2003 = df_st_DD_2003.loc[:,"Total"]
s3_27 = np.sum(t_DD_2003)
s3_27
df_st_DL_2003 = df_2003.loc[(df_2003["State"]=="DELHI (UT)")]
df_st_DL_2003
t_DL_2003 = df_st_DL_2003.loc[:,"Total"]
s3_28 = np.sum(t_DL_2003)
s3_28
df_st_GOA_2003 = df_2003.loc[(df_2003["State"]=="GOA")]
df_st_GOA_2003
t_GOA_2003 = df_st_GOA_2003.loc[:,"Total"]
s3_29 = np.sum(t_GOA_2003)
s3_29
df_st_GJ_2003 = df_2003.loc[(df_2003["State"]=="GUJARAT")]
df_st_GJ_2003
t_GJ_2003 = df_st_GJ_2003.loc[:,"Total"]
s3_30 = np.sum(t_GJ_2003)
s3_30
df_st_HR_2003 = df_2003.loc[(df_2003["State"]=="HARYANA")]
df_st_HR_2003
t_HR_2003 = df_st_HR_2003.loc[:,"Total"]
s3_31 = np.sum(t_HR_2003)
s3_31
df_st_HP_2003 = df_2003.loc[(df_2003["State"]=="HIMACHAL PRADESH")]
df_st_HP_2003
t_HP_2003 = df_st_HP_2003.loc[:,"Total"]
s3_32 = np.sum(t_HP_2003)
s3_32
df_st_JK_2003 = df_2003.loc[(df_2003["State"]=="JAMMU & KASHMIR")]
df_st_JK_2003
t_JK_2003 = df_st_JK_2003.loc[:,"Total"]
s3_33 = np.sum(t_JK_2003)
s3_33
df_st_JH_2003 = df_2003.loc[(df_2003["State"]=="JHARKHAND")]
df_st_JH_2003
t_JH_2003 = df_st_JH_2003.loc[:,"Total"]
s3_34 = np.sum(t_JH_2003)
s3_34
df_st_KN_2003 = df_2003.loc[(df_2003["State"]=="KARNATAKA")]
df_st_KN_2003
t_KN_2003 = df_st_KN_2003.loc[:,"Total"]
s3_35 = np.sum(t_KN_2003)
s3_35
df_st_KER_2003 = df_2003.loc[(df_2003["State"]=="KERALA")]
df_st_KER_2003
t_KER_2003 = df_st_KER_2003.loc[:,"Total"]
s3_36 = np.sum(t_KER_2003)
s3_36
df_st_LD_2003 = df_2003.loc[(df_2003["State"]=="LAKSHADWEEP")]
df_st_LD_2003
t_LD_2003 = df_st_LD_2003.loc[:,"Total"]
s3_37 = np.sum(t_LD_2003)
s3_37
df_st_MP_2003 = df_2003.loc[(df_2003["State"]=="MADHYA PRADESH")]
df_st_MP_2003
t_MP_2003 = df_st_MP_2003.loc[:,"Total"]
s3_38 = np.sum(t_MP_2003)
s3_38
df_st_MH_2003 = df_2003.loc[(df_2003["State"]=="MAHARASHTRA")]
df_st_MH_2003
t_MH_2003 = df_st_MH_2003.loc[:,"Total"]
s3_39 = np.sum(t_MH_2003)
s3_39
df_st_MN_2003 = df_2003.loc[(df_2003["State"]=="MANIPUR")]
df_st_MN_2003
t_MN_2003 = df_st_MN_2003.loc[:,"Total"]
s3_40 = np.sum(t_MN_2003)
s3_40
df_st_MG_2003 = df_2003.loc[(df_2003["State"]=="MEGHALAYA")]
df_st_MG_2003
t_MG_2003 = df_st_MG_2003.loc[:,"Total"]
s3_41 = np.sum(t_MG_2003)
s3_41
df_st_MZ_2003 = df_2003.loc[(df_2003["State"]=="MIZORAM")]
df_st_MZ_2003
t_MN_2003 = df_st_MN_2003.loc[:,"Total"]
s3_42 = np.sum(t_MN_2003)
s3_42
df_st_NG_2003 = df_2003.loc[(df_2003["State"]=="NAGALAND")]
df_st_NG_2003
t_NG_2003 = df_st_NG_2003.loc[:,"Total"]
s3_43 = np.sum(t_NG_2003)
s3_43
df_st_OD_2003 = df_2003.loc[(df_2003["State"]=="ODISHA")]
df_st_OD_2003
t_OD_2003 = df_st_OD_2003.loc[:,"Total"]
s3_44 = np.sum(t_OD_2003)
s3_44
df_st_PD_2003 = df_2003.loc[(df_2003["State"]=="PUDUCHERRY")]
df_st_PD_2003
t_PD_2003 = df_st_PD_2003.loc[:,"Total"]
s3_45 = np.sum(t_PD_2003)
s3_45
df_st_PB_2003 = df_2003.loc[(df_2003["State"]=="PUNJAB")]
df_st_PB_2003
t_PB_2003 = df_st_PB_2003.loc[:,"Total"]
s3_46 = np.sum(t_PB_2003)
s3_46
df_st_RJ_2003 = df_2003.loc[(df_2003["State"]=="RAJASTHAN")]
df_st_RJ_2003
t_RJ_2003 = df_st_RJ_2003.loc[:,"Total"]
s3_47 = np.sum(t_RJ_2003)
s3_47
df_st_SM_2003 = df_2003.loc[(df_2003["State"]=="SIKKIM")]
df_st_SM_2003
t_SM_2003 = df_st_SM_2003.loc[:,"Total"]
s3_48 = np.sum(t_SM_2003)
s3_48
df_st_TN_2003 = df_2003.loc[(df_2003["State"]=="TAMIL NADU")]
df_st_TN_2003
t_TN_2003 = df_st_TN_2003.loc[:,"Total"]
s3_49 = np.sum(t_TN_2003)
s3_49
df_st_TP_2003 = df_2003.loc[(df_2003["State"]=="TRIPURA")]
df_st_TP_2003
t_TP_2003 = df_st_TP_2003.loc[:,"Total"]
s3_50 = np.sum(t_TP_2003)
s3_50
df_st_UP_2003 = df_2003.loc[(df_2003["State"]=="UTTAR PRADESH")]
df_st_UP_2003
t_UP_2003 = df_st_UP_2003.loc[:,"Total"]
s3_51 = np.sum(t_UP_2003)
s3_51
df_st_UK_2003 = df_2003.loc[(df_2003["State"]=="UTTARAKHAND")]
df_st_UK_2003
t_UK_2003 = df_st_UK_2003.loc[:,"Total"]
s3_52 = np.sum(t_UK_2003)
s3_52
df_st_WB_2003 = df_2003.loc[(df_2003["State"]=="WEST BENGAL")]
df_st_WB_2003
t_WB_2003 = df_st_WB_2003.loc[:,"Total"]
s3_53 = np.sum(t_WB_2003)
s3_53
t_ANm_2003 = np.sum(df_st_AN_2003.where(df_st_AN_2003["Gender"]=="Male")["Total"])
t_ANm_2003
t_ANfm_2003 = np.sum(df_st_AN_2003.where(df_st_AN_2003["Gender"]=="Female")["Total"])
t_ANfm_2003
t_APm_2003 = np.sum(df_st_AP_2003.where(df_st_AP_2003["Gender"]=="Male")["Total"])
t_APm_2003
t_APfm_2003 = np.sum(df_st_AP_2003.where(df_st_AP_2003["Gender"]=="Female")["Total"])
t_APfm_2003
t_ARPm_2003 = np.sum(df_st_ARP_2003.where(df_st_ARP_2003["Gender"]=="Male")["Total"])
t_ARPm_2003
t_ARPfm_2003 = np.sum(df_st_ARP_2003.where(df_st_ARP_2003["Gender"]=="Female")["Total"])
t_ARPfm_2003
t_ASm_2003 = np.sum(df_st_AS_2003.where(df_st_AS_2003["Gender"]=="Male")["Total"])
t_ASm_2003
t_ASfm_2003 = np.sum(df_st_AS_2003.where(df_st_AS_2003["Gender"]=="Female")["Total"])
t_ASfm_2003
t_BHm_2003 = np.sum(df_st_BH_2003.where(df_st_BH_2003["Gender"]=="Male")["Total"])
t_BHm_2003
t_BHfm_2003 = np.sum(df_st_BH_2003.where(df_st_BH_2003["Gender"]=="Female")["Total"])
t_BHfm_2003
t_CHm_2003 = np.sum(df_st_CH_2003.where(df_st_CH_2003["Gender"]=="Male")["Total"])
t_CHm_2003
t_CHfm_2003 = np.sum(df_st_CH_2003.where(df_st_CH_2003["Gender"]=="Female")["Total"])
t_CHfm_2003
t_CTm_2003 = np.sum(df_st_CT_2003.where(df_st_CT_2003["Gender"]=="Male")["Total"])
t_CTm_2003
t_CTfm_2003 = np.sum(df_st_CT_2003.where(df_st_CT_2003["Gender"]=="Female")["Total"])
t_CTfm_2003
t_DNm_2003 = np.sum(df_st_DN_2003.where(df_st_DN_2003["Gender"]=="Male")["Total"])
t_DNm_2003
t_DNfm_2003 = np.sum(df_st_DN_2003.where(df_st_DN_2003["Gender"]=="Female")["Total"])
t_DNfm_2003
t_DDm_2003 = np.sum(df_st_DD_2003.where(df_st_DD_2003["Gender"]=="Male")["Total"])
t_DDm_2003
t_DDfm_2003 = np.sum(df_st_DD_2003.where(df_st_DD_2003["Gender"]=="Female")["Total"])
t_DDfm_2003
t_DLm_2003 = np.sum(df_st_DL_2003.where(df_st_DL_2003["Gender"]=="Male")["Total"])
t_DLm_2003
t_DLfm_2003 = np.sum(df_st_DL_2003.where(df_st_DL_2003["Gender"]=="Female")["Total"])
t_DLfm_2003
t_GOAm_2003 = np.sum(df_st_GOA_2003.where(df_st_GOA_2003["Gender"]=="Male")["Total"])
t_GOAm_2003
t_GOAfm_2003 = np.sum(df_st_GOA_2003.where(df_st_GOA_2003["Gender"]=="Female")["Total"])
t_GOAfm_2003
t_GJm_2003 = np.sum(df_st_GJ_2003.where(df_st_GJ_2003["Gender"]=="Male")["Total"])
t_GJm_2003
t_GJfm_2003 = np.sum(df_st_GJ_2003.where(df_st_GJ_2003["Gender"]=="Female")["Total"])
t_GJfm_2003
t_HRm_2003 = np.sum(df_st_HR_2003.where(df_st_HR_2003["Gender"]=="Male")["Total"])
t_HRm_2003
t_HRfm_2003 = np.sum(df_st_HR_2003.where(df_st_HR_2003["Gender"]=="Female")["Total"])
t_HRfm_2003
t_HPm_2003 = np.sum(df_st_HP_2003.where(df_st_HP_2003["Gender"]=="Male")["Total"])
t_HPm_2003
t_HPfm_2003 = np.sum(df_st_HP_2003.where(df_st_HP_2003["Gender"]=="Female")["Total"])
t_HPfm_2003
t_JKm_2003 = np.sum(df_st_JK_2003.where(df_st_JK_2003["Gender"]=="Male")["Total"])
t_JKm_2003
t_JKfm_2003 = np.sum(df_st_JK_2003.where(df_st_JK_2003["Gender"]=="Female")["Total"])
t_JKfm_2003
t_JHm_2003 = np.sum(df_st_JH_2003.where(df_st_JH_2003["Gender"]=="Male")["Total"])
t_JHm_2003
t_JHfm_2003 = np.sum(df_st_JH_2003.where(df_st_JH_2003["Gender"]=="Female")["Total"])
t_JHfm_2003
t_KNm_2003 = np.sum(df_st_KN_2003.where(df_st_KN_2003["Gender"]=="Male")["Total"])
t_KNm_2003
t_KNfm_2003 = np.sum(df_st_KN_2003.where(df_st_KN_2003["Gender"]=="Female")["Total"])
t_KNfm_2003
t_KERm_2003 = np.sum(df_st_KER_2003.where(df_st_KER_2003["Gender"]=="Male")["Total"])
t_KERm_2003
t_KERfm_2003 = np.sum(df_st_KER_2003.where(df_st_KER_2003["Gender"]=="Female")["Total"])
t_KERfm_2003
t_LDm_2003 = np.sum(df_st_LD_2003.where(df_st_LD_2003["Gender"]=="Male")["Total"])
t_LDm_2003
t_LDfm_2003 = np.sum(df_st_LD_2003.where(df_st_LD_2003["Gender"]=="Female")["Total"])
t_LDfm_2003
t_MPm_2003 = np.sum(df_st_MP_2003.where(df_st_MP_2003["Gender"]=="Male")["Total"])
t_MPm_2003
t_MPfm_2003 = np.sum(df_st_MP_2003.where(df_st_MP_2003["Gender"]=="Female")["Total"])
t_MPfm_2003
t_MHm_2003 = np.sum(df_st_MH_2003.where(df_st_MH_2003["Gender"]=="Male")["Total"])
t_MHm_2003
t_MHfm_2003 = np.sum(df_st_MH_2003.where(df_st_MH_2003["Gender"]=="Female")["Total"])
t_MHfm_2003
t_MNm_2003 = np.sum(df_st_MN_2003.where(df_st_MN_2003["Gender"]=="Male")["Total"])
t_MNm_2003
t_MNfm_2003 = np.sum(df_st_MN_2003.where(df_st_MN_2003["Gender"]=="Female")["Total"])
t_MNfm_2003
t_MGm_2003 = np.sum(df_st_MG_2003.where(df_st_MG_2003["Gender"]=="Male")["Total"])
t_MGm_2003
t_MGfm_2003 = np.sum(df_st_MG_2003.where(df_st_MG_2003["Gender"]=="Female")["Total"])
t_MGfm_2003
t_MZm_2003 = np.sum(df_st_MZ_2003.where(df_st_MZ_2003["Gender"]=="Male")["Total"])
t_MZm_2003
t_MZfm_2003 = np.sum(df_st_MZ_2003.where(df_st_MZ_2003["Gender"]=="Female")["Total"])
t_MZfm_2003
t_NGm_2003 = np.sum(df_st_NG_2003.where(df_st_NG_2003["Gender"]=="Male")["Total"])
t_NGm_2003
t_NGfm_2003 = np.sum(df_st_NG_2003.where(df_st_NG_2003["Gender"]=="Female")["Total"])
t_MGfm_2003
t_ODm_2003 = np.sum(df_st_OD_2003.where(df_st_OD_2003["Gender"]=="Male")["Total"])
t_ODm_2003
t_ODfm_2003 = np.sum(df_st_OD_2003.where(df_st_OD_2003["Gender"]=="Female")["Total"])
t_ODfm_2003
t_PDm_2003 = np.sum(df_st_PD_2003.where(df_st_PD_2003["Gender"]=="Male")["Total"])
t_PDm_2003
t_PDfm_2003 = np.sum(df_st_PD_2003.where(df_st_PD_2003["Gender"]=="Female")["Total"])
t_PDfm_2003
t_PBm_2003 = np.sum(df_st_PB_2003.where(df_st_PB_2003["Gender"]=="Male")["Total"])
t_PBm_2003
t_PBfm_2003 = np.sum(df_st_PB_2003.where(df_st_PB_2003["Gender"]=="Female")["Total"])
t_PBfm_2003
t_RJm_2003 = np.sum(df_st_RJ_2003.where(df_st_RJ_2003["Gender"]=="Male")["Total"])
t_RJm_2003
t_RJfm_2003 = np.sum(df_st_RJ_2003.where(df_st_RJ_2003["Gender"]=="Female")["Total"])
t_RJfm_2003
t_SMm_2003 = np.sum(df_st_SM_2003.where(df_st_SM_2003["Gender"]=="Male")["Total"])
t_SMm_2003
t_SMfm_2003 = np.sum(df_st_SM_2003.where(df_st_SM_2003["Gender"]=="Female")["Total"])
t_SMfm_2003
t_TNm_2003 = np.sum(df_st_TN_2003.where(df_st_TN_2003["Gender"]=="Male")["Total"])
t_TNm_2003
t_TNfm_2003 = np.sum(df_st_TN_2003.where(df_st_TN_2003["Gender"]=="Female")["Total"])
t_TNfm_2003
t_TPm_2003 = np.sum(df_st_TP_2003.where(df_st_TP_2003["Gender"]=="Male")["Total"])
t_TPm_2003
t_TPfm_2003 = np.sum(df_st_TP_2003.where(df_st_TP_2003["Gender"]=="Female")["Total"])
t_TPfm_2003
t_UPm_2003 = np.sum(df_st_UP_2003.where(df_st_UP_2003["Gender"]=="Male")["Total"])
t_UPm_2003
t_UPfm_2003 = np.sum(df_st_UP_2003.where(df_st_UP_2003["Gender"]=="Female")["Total"])
t_UPfm_2003
t_UKm_2003 = np.sum(df_st_UK_2003.where(df_st_UK_2003["Gender"]=="Male")["Total"])
t_UKm_2003
t_UKfm_2003 = np.sum(df_st_UK_2003.where(df_st_UK_2003["Gender"]=="Female")["Total"])
t_UKfm_2003
t_WBm_2003 = np.sum(df_st_WB_2003.where(df_st_WB_2003["Gender"]=="Male")["Total"])
t_WBm_2003
t_WBfm_2003 = np.sum(df_st_WB_2003.where(df_st_WB_2003["Gender"]=="Female")["Total"])
t_WBfm_2003
l_2003=list(df_2003.loc[:,"Type"].unique())
l_2003.sort()
print(l_2003,end=" ")
cause_l_2003=[]
for i in l_2003:
rough= np.sum(df_2003.where(df_2003["Type"]==i)["Total"])
cause_l_2003.append(rough)
print(cause_l_2003,end=" ")
x1_2003 = set(df_2003.loc[:,"State"])
x1_2003
len(x1_2003)
cause_df_2003 = pd.DataFrame(cause_l_2003,l_2003)
cause_df_2003.reset_index()
cause_df_2003.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2003",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2003=list(df_2003.loc[:,"State"].unique())
s_2003.sort()
print(s_2003,end=" ")
state_s_2003 = [s3_19,s3_20,s3_21,s3_22,s3_23,s3_24,s3_25,s3_26,s3_27,s3_28,s3_29,s3_30,s3_31,s3_32,s3_33,s3_34,
s3_35,s3_36,s3_37,s3_38,s3_39,s3_40,s3_41,s3_42,s3_43,s3_44,s3_45,s3_46,s3_47,s3_48,s3_49,s3_50,
s3_51,s3_52,s3_53]
print(state_s_2003,end=" ")
state_m_2003=[t_ANm_2003, t_APm_2003, t_ARPm_2003, t_ASm_2003, t_BHm_2003, t_CHm_2003, t_CTm_2003, t_DNm_2003,
t_DDm_2003, t_DLm_2003, t_GOAm_2003, t_GJm_2003, t_HRm_2003, t_HPm_2003,t_JKm_2003, t_JHm_2003,
t_KNm_2003, t_KERm_2003, t_LDm_2003,t_MPm_2003,t_MHm_2003,t_MNm_2003,t_MGm_2003,t_MZm_2003,
t_NGm_2003, t_ODm_2003, t_PDm_2003,t_PBm_2003,t_RJm_2003,t_SMm_2003,t_TNm_2003,t_TPm_2003,
t_UPm_2003, t_UKm_2003, t_WBm_2003]
print(state_m_2003,end=" ")
state_fm_2003=[t_ANfm_2003, t_APfm_2003, t_ARPfm_2003, t_ASfm_2003, t_BHfm_2003, t_CHfm_2003, t_CTfm_2003, t_DNfm_2003,
t_DDfm_2003, t_DLfm_2003, t_GOAfm_2003, t_GJfm_2003, t_HRfm_2003, t_HPfm_2003,t_JKfm_2003, t_JHfm_2003,
t_KNfm_2003, t_KERfm_2003, t_LDfm_2003,t_MPfm_2003,t_MHfm_2003,t_MNfm_2003,t_MGfm_2003,t_MZfm_2003,
t_NGfm_2003, t_ODfm_2003, t_PDfm_2003,t_PBfm_2003,t_RJfm_2003,t_SMfm_2003,t_TNfm_2003,t_TPfm_2003,
t_UPfm_2003, t_UKfm_2003, t_WBfm_2003]
print(state_fm_2003,end=" ")
df_state_2003 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s3_19,s3_20,s3_21,s3_22,s3_23,s3_24,s3_25,s3_26,s3_27,s3_28,s3_29,s3_30,s3_31,s3_32,s3_33,s3_34,
s3_35,s3_36,s3_37,s3_38,s3_39,s3_40,s3_41,s3_42,s3_43,s3_44,s3_45,s3_46,s3_47,s3_48,s3_49,s3_50,
s3_51,s3_52,s3_53],
"Male":[t_ANm_2003, t_APm_2003, t_ARPm_2003, t_ASm_2003, t_BHm_2003, t_CHm_2003, t_CTm_2003, t_DNm_2003,
t_DDm_2003, t_DLm_2003, t_GOAm_2003, t_GJm_2003, t_HRm_2003, t_HPm_2003,t_JKm_2003, t_JHm_2003,
t_KNm_2003, t_KERm_2003, t_LDm_2003,t_MPm_2003,t_MHm_2003,t_MNm_2003,t_MGm_2003,t_MZm_2003,
t_NGm_2003, t_ODm_2003, t_PDm_2003,t_PBm_2003,t_RJm_2003,t_SMm_2003,t_TNm_2003,t_TPm_2003,
t_UPm_2003, t_UKm_2003, t_WBm_2003],
"Female":[t_ANfm_2003, t_APfm_2003, t_ARPfm_2003, t_ASfm_2003, t_BHfm_2003, t_CHfm_2003, t_CTfm_2003, t_DNfm_2003,
t_DDfm_2003, t_DLfm_2003, t_GOAfm_2003, t_GJfm_2003, t_HRfm_2003, t_HPfm_2003,t_JKfm_2003, t_JHfm_2003,
t_KNfm_2003, t_KERfm_2003, t_LDfm_2003,t_MPfm_2003,t_MHfm_2003,t_MNfm_2003,t_MGfm_2003,t_MZfm_2003,
t_NGfm_2003, t_ODfm_2003, t_PDfm_2003,t_PBfm_2003,t_RJfm_2003,t_SMfm_2003,t_TNfm_2003,t_TPfm_2003,
t_UPfm_2003, t_UKfm_2003, t_WBfm_2003]
}
df_All_st_2003 = pd.DataFrame(df_state_2003)
df_All_st_2003
pivot_2003 = pd.pivot_table(df_All_st_2003, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2003
pivot_2003.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2003=[]
for i in cause_l_2003:
p=i/np.sum(cause_l_2003)
avg_2003_cause=p*100
cause_l_percent_2003.append(avg_2003_cause)
print(cause_l_percent_2003,end=" ")
np.max(cause_l_percent_2003) #Married
np.min(cause_l_percent_2003) #Ideological Causes/Hero Worshipping
state_s_2003_percent=[]
tot=np.sum(state_s_2003)
for i in state_s_2003:
xy=i/tot
avg_state_2003=xy*100
state_s_2003_percent.append(avg_state_2003)
print(state_s_2003_percent,end=" ")
np.max(state_s_2003_percent) #Maharashtra
np.min(state_s_2003_percent) #Lakshdweep
l_age_grp_2003=[s3_4,s3_5,s3_6,s3_7,s3_8,s3_54]
l_age_grp_2003
l_age_grp_2003_percent=[]
for i in l_age_grp_2003:
yz=i/s3_1
avg_2003_age_grp=yz*100
l_age_grp_2003_percent.append(avg_2003_age_grp)
l_age_grp_2003_percent
np.max(l_age_grp_2003_percent) #0-100+
np.min(l_age_grp_2003_percent) #0-14
total_male_percent_2003= (s3_2/s3_1)*100
total_male_percent_2003
total_female_percent_2003= (s3_3/s3_1)*100
total_female_percent_2003
df_2004 = suicide_df.loc[(suicide_df["Year"]==2004)]
df_2004
t2004_dcount = df_2004.loc[:,"Total"]
s4_1 = np.sum(t2004_dcount)
s4_1
male_2004 = df_2004.loc[(df_2004["Gender"]=="Male")]
male_2004
m2004_count = male_2004.loc[:,"Total"]
s4_2 = np.sum(m2004_count)
s4_2
female_2004 = df_2004.loc[(df_2004["Gender"]=="Female")]
female_2004
fm2004_count = female_2004.loc[:,"Total"]
s4_3 = np.sum(fm2004_count)
s4_3
df_age_d014_2004 = df_2004.loc[(df_2004["Age_group"]=="0-14")]
df_age_d014_2004
t_014_2004 = df_age_d014_2004.loc[:,"Total"]
s4_4 = np.sum(t_014_2004)
s4_4
df_age_d1529_2004 = df_2004.loc[(df_2004["Age_group"]=="15-29")]
df_age_d1529_2004
t_1529_2004 = df_age_d1529_2004.loc[:,"Total"]
s4_5 = np.sum(t_1529_2004)
s4_5
df_age_d3044_2004 = df_2004.loc[(df_2004["Age_group"]=="30-44")]
df_age_d3044_2004
t_3044_2004 = df_age_d3044_2004.loc[:,"Total"]
s4_6 = np.sum(t_3044_2004)
s4_6
df_age_d4559_2004 = df_2004.loc[(df_2004["Age_group"]=="45-59")]
df_age_d4559_2004
t_4559_2004 = df_age_d4559_2004.loc[:,"Total"]
s4_7 = np.sum(t_4559_2004)
s4_7
df_age_d60_2004 = df_2004.loc[(df_2004["Age_group"]=="60+")]
df_age_d60_2004
t_60_2004 = df_age_d60_2004.loc[:,"Total"]
s4_8 = np.sum(t_60_2004)
s4_8
df_age_d0100_2004 = df_2004.loc[(df_2004["Age_group"]=="0-100+")]
df_age_d0100_2004
t_0100_2004 = df_age_d0100_2004.loc[:,"Total"]
s4_54 = np.sum(t_0100_2004)
s4_54
df_014m_2004 = df_age_d014_2004.loc[(df_age_d014_2004["Gender"]=="Male")]
df_014m_2004
t_014m_2004 = df_014m_2004.loc[:,"Total"]
s4_9 = np.sum(t_014m_2004)
s4_9
df_014fm_2004 = df_age_d014_2004.loc[(df_age_d014_2004["Gender"]=="Female")]
df_014fm_2004
t_014fm_2004 = df_014fm_2004.loc[:,"Total"]
s4_10 = np.sum(t_014fm_2004)
s4_10
df_1529m_2004 = df_age_d1529_2004.loc[(df_age_d1529_2004["Gender"]=="Male")]
df_1529m_2004
t_1529m_2004 = df_1529m_2004.loc[:,"Total"]
s4_11 = np.sum(t_1529m_2004)
s4_11
df_1529fm_2004 = df_age_d1529_2004.loc[(df_age_d1529_2004["Gender"]=="Female")]
df_1529fm_2004
t_1529fm_2004 = df_1529fm_2004.loc[:,"Total"]
s4_12 = np.sum(t_1529fm_2004)
s4_12
df_3044m_2004 = df_age_d3044_2004.loc[(df_age_d3044_2004["Gender"]=="Male")]
df_3044m_2004
t_3044m_2004 = df_3044m_2004.loc[:,"Total"]
s4_13 = np.sum(t_3044m_2004)
s4_13
df_3044fm_2004 = df_age_d3044_2004.loc[(df_age_d3044_2004["Gender"]=="Female")]
df_3044fm_2004
t_3044fm_2004 = df_3044fm_2004.loc[:,"Total"]
s4_14 = np.sum(t_3044fm_2004)
s4_14
df_4559m_2004 = df_age_d4559_2004.loc[(df_age_d4559_2004["Gender"]=="Male")]
df_4559m_2004
t_4559m_2004 = df_4559m_2004.loc[:,"Total"]
s4_15 = np.sum(t_4559m_2004)
s4_15
df_4559fm_2004 = df_age_d4559_2004.loc[(df_age_d4559_2004["Gender"]=="Female")]
df_4559fm_2004
t_4559fm_2004 = df_4559fm_2004.loc[:,"Total"]
s4_16 = np.sum(t_4559fm_2004)
s4_16
df_60m_2004 = df_age_d60_2004.loc[(df_age_d60_2004["Gender"]=="Male")]
df_60m_2004
t_60m_2004 = df_60m_2004.loc[:,"Total"]
s4_17 = np.sum(t_60m_2004)
s4_17
df_60fm_2004 = df_age_d60_2004.loc[(df_age_d60_2004["Gender"]=="Female")]
df_60fm_2004
t_60fm_2004 = df_60fm_2004.loc[:,"Total"]
s4_18 = np.sum(t_60fm_2004)
s4_18
df_0100fm_2004 = df_age_d0100_2004.loc[(df_age_d0100_2004["Gender"]=="Female")]
df_0100fm_2004
t_0100fm_2004 = df_0100fm_2004.loc[:,"Total"]
s4_55 = np.sum(t_0100fm_2004)
s4_55
df_0100m_2004 = df_age_d0100_2004.loc[(df_age_d0100_2004["Gender"]=="Male")]
df_0100m_2004
t_0100m_2004 = df_0100m_2004.loc[:,"Total"]
s4_56 = np.sum(t_0100m_2004)
s4_56
df_st_AN_2004 = df_2004.loc[(df_2004["State"]=="A & N ISLANDS")]
df_st_AN_2004
t_AN_2004 = df_st_AN_2004.loc[:,"Total"]
s4_19 = np.sum(t_AN_2004)
s4_19
df_st_AP_2004 = df_2004.loc[(df_2004["State"]=="ANDHRA PRADESH")]
df_st_AP_2004
t_AP_2004 = df_st_AP_2004.loc[:,"Total"]
s4_20 = np.sum(t_AP_2004)
s4_20
df_st_ARP_2004 = df_2004.loc[(df_2004["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2004
t_ARP_2004 = df_st_ARP_2004.loc[:,"Total"]
s4_21 = np.sum(t_ARP_2004)
s4_21
df_st_AS_2004 = df_2004.loc[(df_2004["State"]=="ASSAM")]
df_st_AS_2004
t_AS_2004 = df_st_AS_2004.loc[:,"Total"]
s4_22 = np.sum(t_AS_2004)
s4_22
df_st_BH_2004 = df_2004.loc[(df_2004["State"]=="BIHAR")]
df_st_BH_2004
t_BH_2004 = df_st_BH_2004.loc[:,"Total"]
s4_23 = np.sum(t_BH_2004)
s4_23
df_st_CH_2004 = df_2004.loc[(df_2004["State"]=="CHANDIGARH")]
df_st_CH_2004
t_CH_2004 = df_st_CH_2004.loc[:,"Total"]
s4_24 = np.sum(t_CH_2004)
s4_24
df_st_CT_2004 = df_2004.loc[(df_2004["State"]=="CHHATTISGARH")]
df_st_CT_2004
t_CT_2004 = df_st_CT_2004.loc[:,"Total"]
s4_25 = np.sum(t_CT_2004)
s4_25
df_st_DN_2004 = df_2004.loc[(df_2004["State"]=="D & N HAVELI")]
df_st_DN_2004
t_DN_2004 = df_st_DN_2004.loc[:,"Total"]
s4_26 = np.sum(t_DN_2004)
s4_26
df_st_DD_2004 = df_2004.loc[(df_2004["State"]=="DAMAN & DIU")]
df_st_DD_2004
t_DD_2004 = df_st_DD_2004.loc[:,"Total"]
s4_27 = np.sum(t_DD_2004)
s4_27
df_st_DL_2004 = df_2004.loc[(df_2004["State"]=="DELHI (UT)")]
df_st_DL_2004
t_DL_2004 = df_st_DL_2004.loc[:,"Total"]
s4_28 = np.sum(t_DL_2004)
s4_28
df_st_GOA_2004 = df_2004.loc[(df_2004["State"]=="GOA")]
df_st_GOA_2004
t_GOA_2004 = df_st_GOA_2004.loc[:,"Total"]
s4_29 = np.sum(t_GOA_2004)
s4_29
df_st_GJ_2004 = df_2004.loc[(df_2004["State"]=="GUJARAT")]
df_st_GJ_2004
t_GJ_2004 = df_st_GJ_2004.loc[:,"Total"]
s4_30 = np.sum(t_GJ_2004)
s4_30
df_st_HR_2004 = df_2004.loc[(df_2004["State"]=="HARYANA")]
df_st_HR_2004
t_HR_2004 = df_st_HR_2004.loc[:,"Total"]
s4_31 = np.sum(t_HR_2004)
s4_31
df_st_HP_2004 = df_2004.loc[(df_2004["State"]=="HIMACHAL PRADESH")]
df_st_HP_2004
t_HP_2004 = df_st_HP_2004.loc[:,"Total"]
s4_32 = np.sum(t_HP_2004)
s4_32
df_st_JK_2004 = df_2004.loc[(df_2004["State"]=="JAMMU & KASHMIR")]
df_st_JK_2004
t_JK_2004 = df_st_JK_2004.loc[:,"Total"]
s4_33 = np.sum(t_JK_2004)
s4_33
df_st_JH_2004 = df_2004.loc[(df_2004["State"]=="JHARKHAND")]
df_st_JH_2004
t_JH_2004 = df_st_JH_2004.loc[:,"Total"]
s4_34 = np.sum(t_JH_2004)
s4_34
df_st_KN_2004 = df_2004.loc[(df_2004["State"]=="KARNATAKA")]
df_st_KN_2004
t_KN_2004 = df_st_KN_2004.loc[:,"Total"]
s4_35 = np.sum(t_KN_2004)
s4_35
df_st_KER_2004 = df_2004.loc[(df_2004["State"]=="KERALA")]
df_st_KER_2004
t_KER_2004 = df_st_KER_2004.loc[:,"Total"]
s4_36 = np.sum(t_KER_2004)
s4_36
df_st_LD_2004 = df_2004.loc[(df_2004["State"]=="LAKSHADWEEP")]
df_st_LD_2004
t_LD_2004 = df_st_LD_2004.loc[:,"Total"]
s4_37 = np.sum(t_LD_2004)
s4_37
df_st_MP_2004 = df_2004.loc[(df_2004["State"]=="MADHYA PRADESH")]
df_st_MP_2004
t_MP_2004 = df_st_MP_2004.loc[:,"Total"]
s4_38 = np.sum(t_MP_2004)
s4_38
df_st_MH_2004 = df_2004.loc[(df_2004["State"]=="MAHARASHTRA")]
df_st_MH_2004
t_MH_2004 = df_st_MH_2004.loc[:,"Total"]
s4_39 = np.sum(t_MH_2004)
s4_39
df_st_MN_2004 = df_2004.loc[(df_2004["State"]=="MANIPUR")]
df_st_MN_2004
t_MN_2004 = df_st_MN_2004.loc[:,"Total"]
s4_40 = np.sum(t_MN_2004)
s4_40
df_st_MG_2004 = df_2004.loc[(df_2004["State"]=="MEGHALAYA")]
df_st_MG_2004
t_MG_2004 = df_st_MG_2004.loc[:,"Total"]
s4_41 = np.sum(t_MG_2004)
s4_41
df_st_MZ_2004 = df_2004.loc[(df_2004["State"]=="MIZORAM")]
df_st_MZ_2004
t_MN_2004 = df_st_MN_2004.loc[:,"Total"]
s4_42 = np.sum(t_MN_2004)
s4_42
df_st_NG_2004 = df_2004.loc[(df_2004["State"]=="NAGALAND")]
df_st_NG_2004
t_NG_2004 = df_st_NG_2004.loc[:,"Total"]
s4_43 = np.sum(t_NG_2004)
s4_43
df_st_OD_2004 = df_2004.loc[(df_2004["State"]=="ODISHA")]
df_st_OD_2004
t_OD_2004 = df_st_OD_2004.loc[:,"Total"]
s4_44 = np.sum(t_OD_2004)
s4_44
df_st_PD_2004 = df_2004.loc[(df_2004["State"]=="PUDUCHERRY")]
df_st_PD_2004
t_PD_2004 = df_st_PD_2004.loc[:,"Total"]
s4_45 = np.sum(t_PD_2004)
s4_45
df_st_PB_2004 = df_2004.loc[(df_2004["State"]=="PUNJAB")]
df_st_PB_2004
t_PB_2004 = df_st_PB_2004.loc[:,"Total"]
s4_46 = np.sum(t_PB_2004)
s4_46
df_st_RJ_2004 = df_2004.loc[(df_2004["State"]=="RAJASTHAN")]
df_st_RJ_2004
t_RJ_2004 = df_st_RJ_2004.loc[:,"Total"]
s4_47 = np.sum(t_RJ_2004)
s4_47
df_st_SM_2004 = df_2004.loc[(df_2004["State"]=="SIKKIM")]
df_st_SM_2004
t_SM_2004 = df_st_SM_2004.loc[:,"Total"]
s4_48 = np.sum(t_SM_2004)
s4_48
df_st_TN_2004 = df_2004.loc[(df_2004["State"]=="TAMIL NADU")]
df_st_TN_2004
t_TN_2004 = df_st_TN_2004.loc[:,"Total"]
s4_49 = np.sum(t_TN_2004)
s4_49
df_st_TP_2004 = df_2004.loc[(df_2004["State"]=="TRIPURA")]
df_st_TP_2004
t_TP_2004 = df_st_TP_2004.loc[:,"Total"]
s4_50 = np.sum(t_TP_2004)
s4_50
df_st_UP_2004 = df_2004.loc[(df_2004["State"]=="UTTAR PRADESH")]
df_st_UP_2004
t_UP_2004 = df_st_UP_2004.loc[:,"Total"]
s4_51 = np.sum(t_UP_2004)
s4_51
df_st_UK_2004 = df_2004.loc[(df_2004["State"]=="UTTARAKHAND")]
df_st_UK_2004
t_UK_2004 = df_st_UK_2004.loc[:,"Total"]
s4_52 = np.sum(t_UK_2004)
s4_52
df_st_WB_2004 = df_2004.loc[(df_2004["State"]=="WEST BENGAL")]
df_st_WB_2004
t_WB_2004 = df_st_WB_2004.loc[:,"Total"]
s4_53 = np.sum(t_WB_2004)
s4_53
t_ANm_2004 = np.sum(df_st_AN_2004.where(df_st_AN_2004["Gender"]=="Male")["Total"])
t_ANm_2004
t_ANfm_2004 = np.sum(df_st_AN_2004.where(df_st_AN_2004["Gender"]=="Female")["Total"])
t_ANfm_2004
t_APm_2004 = np.sum(df_st_AP_2004.where(df_st_AP_2004["Gender"]=="Male")["Total"])
t_APm_2004
t_APfm_2004 = np.sum(df_st_AP_2004.where(df_st_AP_2004["Gender"]=="Female")["Total"])
t_APfm_2004
t_ARPm_2004 = np.sum(df_st_ARP_2004.where(df_st_ARP_2004["Gender"]=="Male")["Total"])
t_ARPm_2004
t_ARPfm_2004 = np.sum(df_st_ARP_2004.where(df_st_ARP_2004["Gender"]=="Female")["Total"])
t_ARPfm_2004
t_ASm_2004 = np.sum(df_st_AS_2004.where(df_st_AS_2004["Gender"]=="Male")["Total"])
t_ASm_2004
t_ASfm_2004 = np.sum(df_st_AS_2004.where(df_st_AS_2004["Gender"]=="Female")["Total"])
t_ASfm_2004
t_BHm_2004 = np.sum(df_st_BH_2004.where(df_st_BH_2004["Gender"]=="Male")["Total"])
t_BHm_2004
t_BHfm_2004 = np.sum(df_st_BH_2004.where(df_st_BH_2004["Gender"]=="Female")["Total"])
t_BHfm_2004
t_CHm_2004 = np.sum(df_st_CH_2004.where(df_st_CH_2004["Gender"]=="Male")["Total"])
t_CHm_2004
t_CHfm_2004 = np.sum(df_st_CH_2004.where(df_st_CH_2004["Gender"]=="Female")["Total"])
t_CHfm_2004
t_CTm_2004 = np.sum(df_st_CT_2004.where(df_st_CT_2004["Gender"]=="Male")["Total"])
t_CTm_2004
t_CTfm_2004 = np.sum(df_st_CT_2004.where(df_st_CT_2004["Gender"]=="Female")["Total"])
t_CTfm_2004
t_DNm_2004 = np.sum(df_st_DN_2004.where(df_st_DN_2004["Gender"]=="Male")["Total"])
t_DNm_2004
t_DNfm_2004 = np.sum(df_st_DN_2004.where(df_st_DN_2004["Gender"]=="Female")["Total"])
t_DNfm_2004
t_DDm_2004 = np.sum(df_st_DD_2004.where(df_st_DD_2004["Gender"]=="Male")["Total"])
t_DDm_2004
t_DDfm_2004 = np.sum(df_st_DD_2004.where(df_st_DD_2004["Gender"]=="Female")["Total"])
t_DDfm_2004
t_DLm_2004 = np.sum(df_st_DL_2004.where(df_st_DL_2004["Gender"]=="Male")["Total"])
t_DLm_2004
t_DLfm_2004 = np.sum(df_st_DL_2004.where(df_st_DL_2004["Gender"]=="Female")["Total"])
t_DLfm_2004
t_GOAm_2004 = np.sum(df_st_GOA_2004.where(df_st_GOA_2004["Gender"]=="Male")["Total"])
t_GOAm_2004
t_GOAfm_2004 = np.sum(df_st_GOA_2004.where(df_st_GOA_2004["Gender"]=="Female")["Total"])
t_GOAfm_2004
t_GJm_2004 = np.sum(df_st_GJ_2004.where(df_st_GJ_2004["Gender"]=="Male")["Total"])
t_GJm_2004
t_GJfm_2004 = np.sum(df_st_GJ_2004.where(df_st_GJ_2004["Gender"]=="Female")["Total"])
t_GJfm_2004
t_HRm_2004 = np.sum(df_st_HR_2004.where(df_st_HR_2004["Gender"]=="Male")["Total"])
t_HRm_2004
t_HRfm_2004 = np.sum(df_st_HR_2004.where(df_st_HR_2004["Gender"]=="Female")["Total"])
t_HRfm_2004
t_HPm_2004 = np.sum(df_st_HP_2004.where(df_st_HP_2004["Gender"]=="Male")["Total"])
t_HPm_2004
t_HPfm_2004 = np.sum(df_st_HP_2004.where(df_st_HP_2004["Gender"]=="Female")["Total"])
t_HPfm_2004
t_JKm_2004 = np.sum(df_st_JK_2004.where(df_st_JK_2004["Gender"]=="Male")["Total"])
t_JKm_2004
t_JKfm_2004 = np.sum(df_st_JK_2004.where(df_st_JK_2004["Gender"]=="Female")["Total"])
t_JKfm_2004
t_JHm_2004 = np.sum(df_st_JH_2004.where(df_st_JH_2004["Gender"]=="Male")["Total"])
t_JHm_2004
t_JHfm_2004 = np.sum(df_st_JH_2004.where(df_st_JH_2004["Gender"]=="Female")["Total"])
t_JHfm_2004
t_KNm_2004 = np.sum(df_st_KN_2004.where(df_st_KN_2004["Gender"]=="Male")["Total"])
t_KNm_2004
t_KNfm_2004 = np.sum(df_st_KN_2004.where(df_st_KN_2004["Gender"]=="Female")["Total"])
t_KNfm_2004
t_KERm_2004 = np.sum(df_st_KER_2004.where(df_st_KER_2004["Gender"]=="Male")["Total"])
t_KERm_2004
t_KERfm_2004 = np.sum(df_st_KER_2004.where(df_st_KER_2004["Gender"]=="Female")["Total"])
t_KERfm_2004
t_LDm_2004 = np.sum(df_st_LD_2004.where(df_st_LD_2004["Gender"]=="Male")["Total"])
t_LDm_2004
t_LDfm_2004 = np.sum(df_st_LD_2004.where(df_st_LD_2004["Gender"]=="Female")["Total"])
t_LDfm_2004
t_MPm_2004 = np.sum(df_st_MP_2004.where(df_st_MP_2004["Gender"]=="Male")["Total"])
t_MPm_2004
t_MPfm_2004 = np.sum(df_st_MP_2004.where(df_st_MP_2004["Gender"]=="Female")["Total"])
t_MPfm_2004
t_MHm_2004 = np.sum(df_st_MH_2004.where(df_st_MH_2004["Gender"]=="Male")["Total"])
t_MHm_2004
t_MHfm_2004 = np.sum(df_st_MH_2004.where(df_st_MH_2004["Gender"]=="Female")["Total"])
t_MHfm_2004
t_MNm_2004 = np.sum(df_st_MN_2004.where(df_st_MN_2004["Gender"]=="Male")["Total"])
t_MNm_2004
t_MNfm_2004 = np.sum(df_st_MN_2004.where(df_st_MN_2004["Gender"]=="Female")["Total"])
t_MNfm_2004
t_MGm_2004 = np.sum(df_st_MG_2004.where(df_st_MG_2004["Gender"]=="Male")["Total"])
t_MGm_2004
t_MGfm_2004 = np.sum(df_st_MG_2004.where(df_st_MG_2004["Gender"]=="Female")["Total"])
t_MGfm_2004
t_MZm_2004 = np.sum(df_st_MZ_2004.where(df_st_MZ_2004["Gender"]=="Male")["Total"])
t_MZm_2004
t_MZfm_2004 = np.sum(df_st_MZ_2004.where(df_st_MZ_2004["Gender"]=="Female")["Total"])
t_MZfm_2004
t_NGm_2004 = np.sum(df_st_NG_2004.where(df_st_NG_2004["Gender"]=="Male")["Total"])
t_NGm_2004
t_NGfm_2004 = np.sum(df_st_NG_2004.where(df_st_NG_2004["Gender"]=="Female")["Total"])
t_MGfm_2004
t_ODm_2004 = np.sum(df_st_OD_2004.where(df_st_OD_2004["Gender"]=="Male")["Total"])
t_ODm_2004
t_ODfm_2004 = np.sum(df_st_OD_2004.where(df_st_OD_2004["Gender"]=="Female")["Total"])
t_ODfm_2004
t_PDm_2004 = np.sum(df_st_PD_2004.where(df_st_PD_2004["Gender"]=="Male")["Total"])
t_PDm_2004
t_PDfm_2004 = np.sum(df_st_PD_2004.where(df_st_PD_2004["Gender"]=="Female")["Total"])
t_PDfm_2004
t_PBm_2004 = np.sum(df_st_PB_2004.where(df_st_PB_2004["Gender"]=="Male")["Total"])
t_PBm_2004
t_PBfm_2004 = np.sum(df_st_PB_2004.where(df_st_PB_2004["Gender"]=="Female")["Total"])
t_PBfm_2004
t_RJm_2004 = np.sum(df_st_RJ_2004.where(df_st_RJ_2004["Gender"]=="Male")["Total"])
t_RJm_2004
t_RJfm_2004 = np.sum(df_st_RJ_2004.where(df_st_RJ_2004["Gender"]=="Female")["Total"])
t_RJfm_2004
t_SMm_2004 = np.sum(df_st_SM_2004.where(df_st_SM_2004["Gender"]=="Male")["Total"])
t_SMm_2004
t_SMfm_2004 = np.sum(df_st_SM_2004.where(df_st_SM_2004["Gender"]=="Female")["Total"])
t_SMfm_2004
t_TNm_2004 = np.sum(df_st_TN_2004.where(df_st_TN_2004["Gender"]=="Male")["Total"])
t_TNm_2004
t_TNfm_2004 = np.sum(df_st_TN_2004.where(df_st_TN_2004["Gender"]=="Female")["Total"])
t_TNfm_2004
t_TPm_2004 = np.sum(df_st_TP_2004.where(df_st_TP_2004["Gender"]=="Male")["Total"])
t_TPm_2004
t_TPfm_2004 = np.sum(df_st_TP_2004.where(df_st_TP_2004["Gender"]=="Female")["Total"])
t_TPfm_2004
t_UPm_2004 = np.sum(df_st_UP_2004.where(df_st_UP_2004["Gender"]=="Male")["Total"])
t_UPm_2004
t_UPfm_2004 = np.sum(df_st_UP_2004.where(df_st_UP_2004["Gender"]=="Female")["Total"])
t_UPfm_2004
t_UKm_2004 = np.sum(df_st_UK_2004.where(df_st_UK_2004["Gender"]=="Male")["Total"])
t_UKm_2004
t_UKfm_2004 = np.sum(df_st_UK_2004.where(df_st_UK_2004["Gender"]=="Female")["Total"])
t_UKfm_2004
t_WBm_2004 = np.sum(df_st_WB_2004.where(df_st_WB_2004["Gender"]=="Male")["Total"])
t_WBm_2004
t_WBfm_2004 = np.sum(df_st_WB_2004.where(df_st_WB_2004["Gender"]=="Female")["Total"])
t_WBfm_2004
l_2004=list(df_2004.loc[:,"Type"].unique())
l_2004.sort()
print(l_2004,end=" ")
cause_l_2004=[]
for i in l_2004:
rough= np.sum(df_2004.where(df_2004["Type"]==i)["Total"])
cause_l_2004.append(rough)
print(cause_l_2004,end=" ")
x1_2004 = set(df_2004.loc[:,"State"])
x1_2004
len(x1_2004)
cause_df_2004 = pd.DataFrame(cause_l_2004,l_2004)
cause_df_2004.reset_index()
cause_df_2004.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2004",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2004=list(df_2004.loc[:,"State"].unique())
s_2004.sort()
print(s_2004,end=" ")
state_s_2004 = [s4_19,s4_20,s4_21,s4_22,s4_23,s4_24,s4_25,s4_26,s4_27,s4_28,s4_29,s4_30,s4_31,s4_32,s4_33,s4_34,
s4_35,s4_36,s4_37,s4_38,s4_39,s4_40,s4_41,s4_42,s4_43,s4_44,s4_45,s4_46,s4_47,s4_48,s4_49,s4_50,
s4_51,s4_52,s4_53]
print(state_s_2004,end=" ")
state_m_2004=[t_ANm_2004, t_APm_2004, t_ARPm_2004, t_ASm_2004, t_BHm_2004, t_CHm_2004, t_CTm_2004, t_DNm_2004,
t_DDm_2004, t_DLm_2004, t_GOAm_2004, t_GJm_2004, t_HRm_2004, t_HPm_2004,t_JKm_2004, t_JHm_2004,
t_KNm_2004, t_KERm_2004, t_LDm_2004,t_MPm_2004,t_MHm_2004,t_MNm_2004,t_MGm_2004,t_MZm_2004,
t_NGm_2004, t_ODm_2004, t_PDm_2004,t_PBm_2004,t_RJm_2004,t_SMm_2004,t_TNm_2004,t_TPm_2004,
t_UPm_2004, t_UKm_2004, t_WBm_2004]
print(state_m_2004,end=" ")
state_fm_2004=[t_ANfm_2004, t_APfm_2004, t_ARPfm_2004, t_ASfm_2004, t_BHfm_2004, t_CHfm_2004, t_CTfm_2004, t_DNfm_2004,
t_DDfm_2004, t_DLfm_2004, t_GOAfm_2004, t_GJfm_2004, t_HRfm_2004, t_HPfm_2004,t_JKfm_2004, t_JHfm_2004,
t_KNfm_2004, t_KERfm_2004, t_LDfm_2004,t_MPfm_2004,t_MHfm_2004,t_MNfm_2004,t_MGfm_2004,t_MZfm_2004,
t_NGfm_2004, t_ODfm_2004, t_PDfm_2004,t_PBfm_2004,t_RJfm_2004,t_SMfm_2004,t_TNfm_2004,t_TPfm_2004,
t_UPfm_2004, t_UKfm_2004, t_WBfm_2004]
print(state_fm_2004,end=" ")
df_state_2004 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s4_19,s4_20,s4_21,s4_22,s4_23,s4_24,s4_25,s4_26,s4_27,s4_28,s4_29,s4_30,s4_31,s4_32,s4_33,s4_34,
s4_35,s4_36,s4_37,s4_38,s4_39,s4_40,s4_41,s4_42,s4_43,s4_44,s4_45,s4_46,s4_47,s4_48,s4_49,s4_50,
s4_51,s4_52,s4_53],
"Male":[t_ANm_2004, t_APm_2004, t_ARPm_2004, t_ASm_2004, t_BHm_2004, t_CHm_2004, t_CTm_2004, t_DNm_2004,
t_DDm_2004, t_DLm_2004, t_GOAm_2004, t_GJm_2004, t_HRm_2004, t_HPm_2004,t_JKm_2004, t_JHm_2004,
t_KNm_2004, t_KERm_2004, t_LDm_2004,t_MPm_2004,t_MHm_2004,t_MNm_2004,t_MGm_2004,t_MZm_2004,
t_NGm_2004, t_ODm_2004, t_PDm_2004,t_PBm_2004,t_RJm_2004,t_SMm_2004,t_TNm_2004,t_TPm_2004,
t_UPm_2004, t_UKm_2004, t_WBm_2004],
"Female":[t_ANfm_2004, t_APfm_2004, t_ARPfm_2004, t_ASfm_2004, t_BHfm_2004, t_CHfm_2004, t_CTfm_2004, t_DNfm_2004,
t_DDfm_2004, t_DLfm_2004, t_GOAfm_2004, t_GJfm_2004, t_HRfm_2004, t_HPfm_2004,t_JKfm_2004, t_JHfm_2004,
t_KNfm_2004, t_KERfm_2004, t_LDfm_2004,t_MPfm_2004,t_MHfm_2004,t_MNfm_2004,t_MGfm_2004,t_MZfm_2004,
t_NGfm_2004, t_ODfm_2004, t_PDfm_2004,t_PBfm_2004,t_RJfm_2004,t_SMfm_2004,t_TNfm_2004,t_TPfm_2004,
t_UPfm_2004, t_UKfm_2004, t_WBfm_2004]
}
df_All_st_2004 = pd.DataFrame(df_state_2004)
df_All_st_2004
pivot_2004 = pd.pivot_table(df_All_st_2004, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2004
pivot_2004.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2004=[]
for i in cause_l_2004:
p=i/np.sum(cause_l_2004)
avg_2004_cause=p*100
cause_l_percent_2004.append(avg_2004_cause)
print(cause_l_percent_2004,end=" ")
np.max(cause_l_percent_2004) #Married
np.min(cause_l_percent_2004) #Ideological Causes/Hero Worshipping
state_s_2004_percent=[]
tot=np.sum(state_s_2004)
for i in state_s_2004:
xy=i/tot
avg_state_2004=xy*100
state_s_2004_percent.append(avg_state_2004)
print(state_s_2004_percent,end=" ")
np.max(state_s_2004_percent) #Maharashtra
np.min(state_s_2004_percent) #Lakshdweep
l_age_grp_2004=[s4_4,s4_5,s4_6,s4_7,s4_8,s4_54]
l_age_grp_2004
l_age_grp_2004_percent=[]
for i in l_age_grp_2004:
yz=i/s4_1
avg_2004_age_grp=yz*100
l_age_grp_2004_percent.append(avg_2004_age_grp)
l_age_grp_2004_percent
np.max(l_age_grp_2004_percent) #0-100+
np.min(l_age_grp_2004_percent) #0-14
total_male_percent_2004= (s4_2/s4_1)*100
total_male_percent_2004
total_female_percent_2004= (s4_3/s4_1)*100
total_female_percent_2004
df_2005 = suicide_df.loc[(suicide_df["Year"]==2005)]
df_2005
t2005_dcount = df_2005.loc[:,"Total"]
s5_1 = np.sum(t2005_dcount)
s5_1
male_2005 = df_2005.loc[(df_2005["Gender"]=="Male")]
male_2005
m2005_count = male_2005.loc[:,"Total"]
s5_2 = np.sum(m2005_count)
s5_2
female_2005 = df_2005.loc[(df_2005["Gender"]=="Female")]
female_2005
fm2005_count = female_2005.loc[:,"Total"]
s5_3 = np.sum(fm2005_count)
s5_3
df_age_d014_2005 = df_2005.loc[(df_2005["Age_group"]=="0-14")]
df_age_d014_2005
t_014_2005 = df_age_d014_2005.loc[:,"Total"]
s5_4 = np.sum(t_014_2005)
s5_4
df_age_d1529_2005 = df_2005.loc[(df_2005["Age_group"]=="15-29")]
df_age_d1529_2005
t_1529_2005 = df_age_d1529_2005.loc[:,"Total"]
s5_5 = np.sum(t_1529_2005)
s5_5
df_age_d3044_2005 = df_2005.loc[(df_2005["Age_group"]=="30-44")]
df_age_d3044_2005
t_3044_2005 = df_age_d3044_2005.loc[:,"Total"]
s5_6 = np.sum(t_3044_2005)
s5_6
df_age_d4559_2005 = df_2005.loc[(df_2005["Age_group"]=="45-59")]
df_age_d4559_2005
t_4559_2005 = df_age_d4559_2005.loc[:,"Total"]
s5_7 = np.sum(t_4559_2005)
s5_7
df_age_d60_2005 = df_2005.loc[(df_2005["Age_group"]=="60+")]
df_age_d60_2005
t_60_2005 = df_age_d60_2005.loc[:,"Total"]
s5_8 = np.sum(t_60_2005)
s5_8
df_age_d0100_2005 = df_2005.loc[(df_2005["Age_group"]=="0-100+")]
df_age_d0100_2005
t_0100_2005 = df_age_d0100_2005.loc[:,"Total"]
s5_54 = np.sum(t_0100_2005)
s5_54
df_014m_2005 = df_age_d014_2005.loc[(df_age_d014_2005["Gender"]=="Male")]
df_014m_2005
t_014m_2005 = df_014m_2005.loc[:,"Total"]
s5_9 = np.sum(t_014m_2005)
s5_9
df_014fm_2005 = df_age_d014_2005.loc[(df_age_d014_2005["Gender"]=="Female")]
df_014fm_2005
t_014fm_2005 = df_014fm_2005.loc[:,"Total"]
s5_10 = np.sum(t_014fm_2005)
s5_10
df_1529m_2005 = df_age_d1529_2005.loc[(df_age_d1529_2005["Gender"]=="Male")]
df_1529m_2005
t_1529m_2005 = df_1529m_2005.loc[:,"Total"]
s5_11 = np.sum(t_1529m_2005)
s5_11
df_1529fm_2005 = df_age_d1529_2005.loc[(df_age_d1529_2005["Gender"]=="Female")]
df_1529fm_2005
t_1529fm_2005 = df_1529fm_2005.loc[:,"Total"]
s5_12 = np.sum(t_1529fm_2005)
s5_12
df_3044m_2005 = df_age_d3044_2005.loc[(df_age_d3044_2005["Gender"]=="Male")]
df_3044m_2005
t_3044m_2005 = df_3044m_2005.loc[:,"Total"]
s5_13 = np.sum(t_3044m_2005)
s5_13
df_3044fm_2005 = df_age_d3044_2005.loc[(df_age_d3044_2005["Gender"]=="Female")]
df_3044fm_2005
t_3044fm_2005 = df_3044fm_2005.loc[:,"Total"]
s5_14 = np.sum(t_3044fm_2005)
s5_14
df_4559m_2005 = df_age_d4559_2005.loc[(df_age_d4559_2005["Gender"]=="Male")]
df_4559m_2005
t_4559m_2005 = df_4559m_2005.loc[:,"Total"]
s5_15 = np.sum(t_4559m_2005)
s5_15
df_4559fm_2005 = df_age_d4559_2005.loc[(df_age_d4559_2005["Gender"]=="Female")]
df_4559fm_2005
t_4559fm_2005 = df_4559fm_2005.loc[:,"Total"]
s5_16 = np.sum(t_4559fm_2005)
s5_16
df_60m_2005 = df_age_d60_2005.loc[(df_age_d60_2005["Gender"]=="Male")]
df_60m_2005
t_60m_2005 = df_60m_2005.loc[:,"Total"]
s5_17 = np.sum(t_60m_2005)
s5_17
df_60fm_2005 = df_age_d60_2005.loc[(df_age_d60_2005["Gender"]=="Female")]
df_60fm_2005
t_60fm_2005 = df_60fm_2005.loc[:,"Total"]
s5_18 = np.sum(t_60fm_2005)
s5_18
df_0100fm_2005 = df_age_d0100_2005.loc[(df_age_d0100_2005["Gender"]=="Female")]
df_0100fm_2005
t_0100fm_2005 = df_0100fm_2005.loc[:,"Total"]
s5_55 = np.sum(t_0100fm_2005)
s5_55
df_0100m_2005 = df_age_d0100_2005.loc[(df_age_d0100_2005["Gender"]=="Male")]
df_0100m_2005
t_0100m_2005 = df_0100m_2005.loc[:,"Total"]
s5_56 = np.sum(t_0100m_2005)
s5_56
df_st_AN_2005 = df_2005.loc[(df_2005["State"]=="A & N ISLANDS")]
df_st_AN_2005
t_AN_2005 = df_st_AN_2005.loc[:,"Total"]
s5_19 = np.sum(t_AN_2005)
s5_19
df_st_AP_2005 = df_2005.loc[(df_2005["State"]=="ANDHRA PRADESH")]
df_st_AP_2005
t_AP_2005 = df_st_AP_2005.loc[:,"Total"]
s5_20 = np.sum(t_AP_2005)
s5_20
df_st_ARP_2005 = df_2005.loc[(df_2005["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2005
t_ARP_2005 = df_st_ARP_2005.loc[:,"Total"]
s5_21 = np.sum(t_ARP_2005)
s5_21
df_st_AS_2005 = df_2005.loc[(df_2005["State"]=="ASSAM")]
df_st_AS_2005
t_AS_2005 = df_st_AS_2005.loc[:,"Total"]
s5_22 = np.sum(t_AS_2005)
s5_22
df_st_BH_2005 = df_2005.loc[(df_2005["State"]=="BIHAR")]
df_st_BH_2005
t_BH_2005 = df_st_BH_2005.loc[:,"Total"]
s5_23 = np.sum(t_BH_2005)
s5_23
df_st_CH_2005 = df_2005.loc[(df_2005["State"]=="CHANDIGARH")]
df_st_CH_2005
t_CH_2005 = df_st_CH_2005.loc[:,"Total"]
s5_24 = np.sum(t_CH_2005)
s5_24
df_st_CT_2005 = df_2005.loc[(df_2005["State"]=="CHHATTISGARH")]
df_st_CT_2005
t_CT_2005 = df_st_CT_2005.loc[:,"Total"]
s5_25 = np.sum(t_CT_2005)
s5_25
df_st_DN_2005 = df_2005.loc[(df_2005["State"]=="D & N HAVELI")]
df_st_DN_2005
t_DN_2005 = df_st_DN_2005.loc[:,"Total"]
s5_26 = np.sum(t_DN_2005)
s5_26
df_st_DD_2005 = df_2005.loc[(df_2005["State"]=="DAMAN & DIU")]
df_st_DD_2005
t_DD_2005 = df_st_DD_2005.loc[:,"Total"]
s5_27 = np.sum(t_DD_2005)
s5_27
df_st_DL_2005 = df_2005.loc[(df_2005["State"]=="DELHI (UT)")]
df_st_DL_2005
t_DL_2005 = df_st_DL_2005.loc[:,"Total"]
s5_28 = np.sum(t_DL_2005)
s5_28
df_st_GOA_2005 = df_2005.loc[(df_2005["State"]=="GOA")]
df_st_GOA_2005
t_GOA_2005 = df_st_GOA_2005.loc[:,"Total"]
s5_29 = np.sum(t_GOA_2005)
s5_29
df_st_GJ_2005 = df_2005.loc[(df_2005["State"]=="GUJARAT")]
df_st_GJ_2005
t_GJ_2005 = df_st_GJ_2005.loc[:,"Total"]
s5_30 = np.sum(t_GJ_2005)
s5_30
df_st_HR_2005 = df_2005.loc[(df_2005["State"]=="HARYANA")]
df_st_HR_2005
t_HR_2005 = df_st_HR_2005.loc[:,"Total"]
s5_31 = np.sum(t_HR_2005)
s5_31
df_st_HP_2005 = df_2005.loc[(df_2005["State"]=="HIMACHAL PRADESH")]
df_st_HP_2005
t_HP_2005 = df_st_HP_2005.loc[:,"Total"]
s5_32 = np.sum(t_HP_2005)
s5_32
df_st_JK_2005 = df_2005.loc[(df_2005["State"]=="JAMMU & KASHMIR")]
df_st_JK_2005
t_JK_2005 = df_st_JK_2005.loc[:,"Total"]
s5_33 = np.sum(t_JK_2005)
s5_33
df_st_JH_2005 = df_2005.loc[(df_2005["State"]=="JHARKHAND")]
df_st_JH_2005
t_JH_2005 = df_st_JH_2005.loc[:,"Total"]
s5_34 = np.sum(t_JH_2005)
s5_34
df_st_KN_2005 = df_2005.loc[(df_2005["State"]=="KARNATAKA")]
df_st_KN_2005
t_KN_2005 = df_st_KN_2005.loc[:,"Total"]
s5_35 = np.sum(t_KN_2005)
s5_35
df_st_KER_2005 = df_2005.loc[(df_2005["State"]=="KERALA")]
df_st_KER_2005
t_KER_2005 = df_st_KER_2005.loc[:,"Total"]
s5_36 = np.sum(t_KER_2005)
s5_36
df_st_LD_2005 = df_2005.loc[(df_2005["State"]=="LAKSHADWEEP")]
df_st_LD_2005
t_LD_2005 = df_st_LD_2005.loc[:,"Total"]
s5_37 = np.sum(t_LD_2005)
s5_37
df_st_MP_2005 = df_2005.loc[(df_2005["State"]=="MADHYA PRADESH")]
df_st_MP_2005
t_MP_2005 = df_st_MP_2005.loc[:,"Total"]
s5_38 = np.sum(t_MP_2005)
s5_38
df_st_MH_2005 = df_2005.loc[(df_2005["State"]=="MAHARASHTRA")]
df_st_MH_2005
t_MH_2005 = df_st_MH_2005.loc[:,"Total"]
s5_39 = np.sum(t_MH_2005)
s5_39
df_st_MN_2005 = df_2005.loc[(df_2005["State"]=="MANIPUR")]
df_st_MN_2005
t_MN_2005 = df_st_MN_2005.loc[:,"Total"]
s5_40 = np.sum(t_MN_2005)
s5_40
df_st_MG_2005 = df_2005.loc[(df_2005["State"]=="MEGHALAYA")]
df_st_MG_2005
t_MG_2005 = df_st_MG_2005.loc[:,"Total"]
s5_41 = np.sum(t_MG_2005)
s5_41
df_st_MZ_2005 = df_2005.loc[(df_2005["State"]=="MIZORAM")]
df_st_MZ_2005
t_MN_2005 = df_st_MN_2005.loc[:,"Total"]
s5_42 = np.sum(t_MN_2005)
s5_42
df_st_NG_2005 = df_2005.loc[(df_2005["State"]=="NAGALAND")]
df_st_NG_2005
t_NG_2005 = df_st_NG_2005.loc[:,"Total"]
s5_43 = np.sum(t_NG_2005)
s5_43
df_st_OD_2005 = df_2005.loc[(df_2005["State"]=="ODISHA")]
df_st_OD_2005
t_OD_2005 = df_st_OD_2005.loc[:,"Total"]
s5_44 = np.sum(t_OD_2005)
s5_44
df_st_PD_2005 = df_2005.loc[(df_2005["State"]=="PUDUCHERRY")]
df_st_PD_2005
t_PD_2005 = df_st_PD_2005.loc[:,"Total"]
s5_45 = np.sum(t_PD_2005)
s5_45
df_st_PB_2005 = df_2005.loc[(df_2005["State"]=="PUNJAB")]
df_st_PB_2005
t_PB_2005 = df_st_PB_2005.loc[:,"Total"]
s5_46 = np.sum(t_PB_2005)
s5_46
df_st_RJ_2005 = df_2005.loc[(df_2005["State"]=="RAJASTHAN")]
df_st_RJ_2005
t_RJ_2005 = df_st_RJ_2005.loc[:,"Total"]
s5_47 = np.sum(t_RJ_2005)
s5_47
df_st_SM_2005 = df_2005.loc[(df_2005["State"]=="SIKKIM")]
df_st_SM_2005
t_SM_2005 = df_st_SM_2005.loc[:,"Total"]
s5_48 = np.sum(t_SM_2005)
s5_48
df_st_TN_2005 = df_2005.loc[(df_2005["State"]=="TAMIL NADU")]
df_st_TN_2005
t_TN_2005 = df_st_TN_2005.loc[:,"Total"]
s5_49 = np.sum(t_TN_2005)
s5_49
df_st_TP_2005 = df_2005.loc[(df_2005["State"]=="TRIPURA")]
df_st_TP_2005
t_TP_2005 = df_st_TP_2005.loc[:,"Total"]
s5_50 = np.sum(t_TP_2005)
s5_50
df_st_UP_2005 = df_2005.loc[(df_2005["State"]=="UTTAR PRADESH")]
df_st_UP_2005
t_UP_2005 = df_st_UP_2005.loc[:,"Total"]
s5_51 = np.sum(t_UP_2005)
s5_51
df_st_UK_2005 = df_2005.loc[(df_2005["State"]=="UTTARAKHAND")]
df_st_UK_2005
t_UK_2005 = df_st_UK_2005.loc[:,"Total"]
s5_52 = np.sum(t_UK_2005)
s5_52
df_st_WB_2005 = df_2005.loc[(df_2005["State"]=="WEST BENGAL")]
df_st_WB_2005
t_WB_2005 = df_st_WB_2005.loc[:,"Total"]
s5_53 = np.sum(t_WB_2005)
s5_53
t_ANm_2005 = np.sum(df_st_AN_2005.where(df_st_AN_2005["Gender"]=="Male")["Total"])
t_ANm_2005
t_ANfm_2005 = np.sum(df_st_AN_2005.where(df_st_AN_2005["Gender"]=="Female")["Total"])
t_ANfm_2005
t_APm_2005 = np.sum(df_st_AP_2005.where(df_st_AP_2005["Gender"]=="Male")["Total"])
t_APm_2005
t_APfm_2005 = np.sum(df_st_AP_2005.where(df_st_AP_2005["Gender"]=="Female")["Total"])
t_APfm_2005
t_ARPm_2005 = np.sum(df_st_ARP_2005.where(df_st_ARP_2005["Gender"]=="Male")["Total"])
t_ARPm_2005
t_ARPfm_2005 = np.sum(df_st_ARP_2005.where(df_st_ARP_2005["Gender"]=="Female")["Total"])
t_ARPfm_2005
t_ASm_2005 = np.sum(df_st_AS_2005.where(df_st_AS_2005["Gender"]=="Male")["Total"])
t_ASm_2005
t_ASfm_2005 = np.sum(df_st_AS_2005.where(df_st_AS_2005["Gender"]=="Female")["Total"])
t_ASfm_2005
t_BHm_2005 = np.sum(df_st_BH_2005.where(df_st_BH_2005["Gender"]=="Male")["Total"])
t_BHm_2005
t_BHfm_2005 = np.sum(df_st_BH_2005.where(df_st_BH_2005["Gender"]=="Female")["Total"])
t_BHfm_2005
t_CHm_2005 = np.sum(df_st_CH_2005.where(df_st_CH_2005["Gender"]=="Male")["Total"])
t_CHm_2005
t_CHfm_2005 = np.sum(df_st_CH_2005.where(df_st_CH_2005["Gender"]=="Female")["Total"])
t_CHfm_2005
t_CTm_2005 = np.sum(df_st_CT_2005.where(df_st_CT_2005["Gender"]=="Male")["Total"])
t_CTm_2005
t_CTfm_2005 = np.sum(df_st_CT_2005.where(df_st_CT_2005["Gender"]=="Female")["Total"])
t_CTfm_2005
t_DNm_2005 = np.sum(df_st_DN_2005.where(df_st_DN_2005["Gender"]=="Male")["Total"])
t_DNm_2005
t_DNfm_2005 = np.sum(df_st_DN_2005.where(df_st_DN_2005["Gender"]=="Female")["Total"])
t_DNfm_2005
t_DDm_2005 = np.sum(df_st_DD_2005.where(df_st_DD_2005["Gender"]=="Male")["Total"])
t_DDm_2005
t_DDfm_2005 = np.sum(df_st_DD_2005.where(df_st_DD_2005["Gender"]=="Female")["Total"])
t_DDfm_2005
t_DLm_2005 = np.sum(df_st_DL_2005.where(df_st_DL_2005["Gender"]=="Male")["Total"])
t_DLm_2005
t_DLfm_2005 = np.sum(df_st_DL_2005.where(df_st_DL_2005["Gender"]=="Female")["Total"])
t_DLfm_2005
t_GOAm_2005 = np.sum(df_st_GOA_2005.where(df_st_GOA_2005["Gender"]=="Male")["Total"])
t_GOAm_2005
t_GOAfm_2005 = np.sum(df_st_GOA_2005.where(df_st_GOA_2005["Gender"]=="Female")["Total"])
t_GOAfm_2005
t_GJm_2005 = np.sum(df_st_GJ_2005.where(df_st_GJ_2005["Gender"]=="Male")["Total"])
t_GJm_2005
t_GJfm_2005 = np.sum(df_st_GJ_2005.where(df_st_GJ_2005["Gender"]=="Female")["Total"])
t_GJfm_2005
t_HRm_2005 = np.sum(df_st_HR_2005.where(df_st_HR_2005["Gender"]=="Male")["Total"])
t_HRm_2005
t_HRfm_2005 = np.sum(df_st_HR_2005.where(df_st_HR_2005["Gender"]=="Female")["Total"])
t_HRfm_2005
t_HPm_2005 = np.sum(df_st_HP_2005.where(df_st_HP_2005["Gender"]=="Male")["Total"])
t_HPm_2005
t_HPfm_2005 = np.sum(df_st_HP_2005.where(df_st_HP_2005["Gender"]=="Female")["Total"])
t_HPfm_2005
t_JKm_2005 = np.sum(df_st_JK_2005.where(df_st_JK_2005["Gender"]=="Male")["Total"])
t_JKm_2005
t_JKfm_2005 = np.sum(df_st_JK_2005.where(df_st_JK_2005["Gender"]=="Female")["Total"])
t_JKfm_2005
t_JHm_2005 = np.sum(df_st_JH_2005.where(df_st_JH_2005["Gender"]=="Male")["Total"])
t_JHm_2005
t_JHfm_2005 = np.sum(df_st_JH_2005.where(df_st_JH_2005["Gender"]=="Female")["Total"])
t_JHfm_2005
t_KNm_2005 = np.sum(df_st_KN_2005.where(df_st_KN_2005["Gender"]=="Male")["Total"])
t_KNm_2005
t_KNfm_2005 = np.sum(df_st_KN_2005.where(df_st_KN_2005["Gender"]=="Female")["Total"])
t_KNfm_2005
t_KERm_2005 = np.sum(df_st_KER_2005.where(df_st_KER_2005["Gender"]=="Male")["Total"])
t_KERm_2005
t_KERfm_2005 = np.sum(df_st_KER_2005.where(df_st_KER_2005["Gender"]=="Female")["Total"])
t_KERfm_2005
t_LDm_2005 = np.sum(df_st_LD_2005.where(df_st_LD_2005["Gender"]=="Male")["Total"])
t_LDm_2005
t_LDfm_2005 = np.sum(df_st_LD_2005.where(df_st_LD_2005["Gender"]=="Female")["Total"])
t_LDfm_2005
t_MPm_2005 = np.sum(df_st_MP_2005.where(df_st_MP_2005["Gender"]=="Male")["Total"])
t_MPm_2005
t_MPfm_2005 = np.sum(df_st_MP_2005.where(df_st_MP_2005["Gender"]=="Female")["Total"])
t_MPfm_2005
t_MHm_2005 = np.sum(df_st_MH_2005.where(df_st_MH_2005["Gender"]=="Male")["Total"])
t_MHm_2005
t_MHfm_2005 = np.sum(df_st_MH_2005.where(df_st_MH_2005["Gender"]=="Female")["Total"])
t_MHfm_2005
t_MNm_2005 = np.sum(df_st_MN_2005.where(df_st_MN_2005["Gender"]=="Male")["Total"])
t_MNm_2005
t_MNfm_2005 = np.sum(df_st_MN_2005.where(df_st_MN_2005["Gender"]=="Female")["Total"])
t_MNfm_2005
t_MGm_2005 = np.sum(df_st_MG_2005.where(df_st_MG_2005["Gender"]=="Male")["Total"])
t_MGm_2005
t_MGfm_2005 = np.sum(df_st_MG_2005.where(df_st_MG_2005["Gender"]=="Female")["Total"])
t_MGfm_2005
t_MZm_2005 = np.sum(df_st_MZ_2005.where(df_st_MZ_2005["Gender"]=="Male")["Total"])
t_MZm_2005
t_MZfm_2005 = np.sum(df_st_MZ_2005.where(df_st_MZ_2005["Gender"]=="Female")["Total"])
t_MZfm_2005
t_NGm_2005 = np.sum(df_st_NG_2005.where(df_st_NG_2005["Gender"]=="Male")["Total"])
t_NGm_2005
t_NGfm_2005 = np.sum(df_st_NG_2005.where(df_st_NG_2005["Gender"]=="Female")["Total"])
t_MGfm_2005
t_ODm_2005 = np.sum(df_st_OD_2005.where(df_st_OD_2005["Gender"]=="Male")["Total"])
t_ODm_2005
t_ODfm_2005 = np.sum(df_st_OD_2005.where(df_st_OD_2005["Gender"]=="Female")["Total"])
t_ODfm_2005
t_PDm_2005 = np.sum(df_st_PD_2005.where(df_st_PD_2005["Gender"]=="Male")["Total"])
t_PDm_2005
t_PDfm_2005 = np.sum(df_st_PD_2005.where(df_st_PD_2005["Gender"]=="Female")["Total"])
t_PDfm_2005
t_PBm_2005 = np.sum(df_st_PB_2005.where(df_st_PB_2005["Gender"]=="Male")["Total"])
t_PBm_2005
t_PBfm_2005 = np.sum(df_st_PB_2005.where(df_st_PB_2005["Gender"]=="Female")["Total"])
t_PBfm_2005
t_RJm_2005 = np.sum(df_st_RJ_2005.where(df_st_RJ_2005["Gender"]=="Male")["Total"])
t_RJm_2005
t_RJfm_2005 = np.sum(df_st_RJ_2005.where(df_st_RJ_2005["Gender"]=="Female")["Total"])
t_RJfm_2005
t_SMm_2005 = np.sum(df_st_SM_2005.where(df_st_SM_2005["Gender"]=="Male")["Total"])
t_SMm_2005
t_SMfm_2005 = np.sum(df_st_SM_2005.where(df_st_SM_2005["Gender"]=="Female")["Total"])
t_SMfm_2005
t_TNm_2005 = np.sum(df_st_TN_2005.where(df_st_TN_2005["Gender"]=="Male")["Total"])
t_TNm_2005
t_TNfm_2005 = np.sum(df_st_TN_2005.where(df_st_TN_2005["Gender"]=="Female")["Total"])
t_TNfm_2005
t_TPm_2005 = np.sum(df_st_TP_2005.where(df_st_TP_2005["Gender"]=="Male")["Total"])
t_TPm_2005
t_TPfm_2005 = np.sum(df_st_TP_2005.where(df_st_TP_2005["Gender"]=="Female")["Total"])
t_TPfm_2005
t_UPm_2005 = np.sum(df_st_UP_2005.where(df_st_UP_2005["Gender"]=="Male")["Total"])
t_UPm_2005
t_UPfm_2005 = np.sum(df_st_UP_2005.where(df_st_UP_2005["Gender"]=="Female")["Total"])
t_UPfm_2005
t_UKm_2005 = np.sum(df_st_UK_2005.where(df_st_UK_2005["Gender"]=="Male")["Total"])
t_UKm_2005
t_UKfm_2005 = np.sum(df_st_UK_2005.where(df_st_UK_2005["Gender"]=="Female")["Total"])
t_UKfm_2005
t_WBm_2005 = np.sum(df_st_WB_2005.where(df_st_WB_2005["Gender"]=="Male")["Total"])
t_WBm_2005
t_WBfm_2005 = np.sum(df_st_WB_2005.where(df_st_WB_2005["Gender"]=="Female")["Total"])
t_WBfm_2005
l_2005=list(df_2005.loc[:,"Type"].unique())
l_2005.sort()
print(l_2005,end=" ")
cause_l_2005=[]
for i in l_2005:
rough= np.sum(df_2005.where(df_2005["Type"]==i)["Total"])
cause_l_2005.append(rough)
print(cause_l_2005,end=" ")
x1_2005 = set(df_2005.loc[:,"State"])
x1_2005
len(x1_2005)
cause_df_2005 = pd.DataFrame(cause_l_2005,l_2005)
cause_df_2005.reset_index()
cause_df_2005.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2005",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2005=list(df_2005.loc[:,"State"].unique())
s_2005.sort()
print(s_2005,end=" ")
state_s_2005 = [s5_19,s5_20,s5_21,s5_22,s5_23,s5_24,s5_25,s5_26,s5_27,s5_28,s5_29,s5_30,s5_31,s5_32,s5_33,s5_34,
s5_35,s5_36,s5_37,s5_38,s5_39,s5_40,s5_41,s5_42,s5_43,s5_44,s5_45,s5_46,s5_47,s5_48,s5_49,s5_50,
s5_51,s5_52,s5_53]
print(state_s_2005,end=" ")
state_m_2005=[t_ANm_2005, t_APm_2005, t_ARPm_2005, t_ASm_2005, t_BHm_2005, t_CHm_2005, t_CTm_2005, t_DNm_2005,
t_DDm_2005, t_DLm_2005, t_GOAm_2005, t_GJm_2005, t_HRm_2005, t_HPm_2005,t_JKm_2005, t_JHm_2005,
t_KNm_2005, t_KERm_2005, t_LDm_2005,t_MPm_2005,t_MHm_2005,t_MNm_2005,t_MGm_2005,t_MZm_2005,
t_NGm_2005, t_ODm_2005, t_PDm_2005,t_PBm_2005,t_RJm_2005,t_SMm_2005,t_TNm_2005,t_TPm_2005,
t_UPm_2005, t_UKm_2005, t_WBm_2005]
print(state_m_2005,end=" ")
state_fm_2005=[t_ANfm_2005, t_APfm_2005, t_ARPfm_2005, t_ASfm_2005, t_BHfm_2005, t_CHfm_2005, t_CTfm_2005, t_DNfm_2005,
t_DDfm_2005, t_DLfm_2005, t_GOAfm_2005, t_GJfm_2005, t_HRfm_2005, t_HPfm_2005,t_JKfm_2005, t_JHfm_2005,
t_KNfm_2005, t_KERfm_2005, t_LDfm_2005,t_MPfm_2005,t_MHfm_2005,t_MNfm_2005,t_MGfm_2005,t_MZfm_2005,
t_NGfm_2005, t_ODfm_2005, t_PDfm_2005,t_PBfm_2005,t_RJfm_2005,t_SMfm_2005,t_TNfm_2005,t_TPfm_2005,
t_UPfm_2005, t_UKfm_2005, t_WBfm_2005]
print(state_fm_2005,end=" ")
df_state_2005 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s5_19,s5_20,s5_21,s5_22,s5_23,s5_24,s5_25,s5_26,s5_27,s5_28,s5_29,s5_30,s5_31,s5_32,s5_33,s5_34,
s5_35,s5_36,s5_37,s5_38,s5_39,s5_40,s5_41,s5_42,s5_43,s5_44,s5_45,s5_46,s5_47,s5_48,s5_49,s5_50,
s5_51,s5_52,s5_53],
"Male":[t_ANm_2005, t_APm_2005, t_ARPm_2005, t_ASm_2005, t_BHm_2005, t_CHm_2005, t_CTm_2005, t_DNm_2005,
t_DDm_2005, t_DLm_2005, t_GOAm_2005, t_GJm_2005, t_HRm_2005, t_HPm_2005,t_JKm_2005, t_JHm_2005,
t_KNm_2005, t_KERm_2005, t_LDm_2005,t_MPm_2005,t_MHm_2005,t_MNm_2005,t_MGm_2005,t_MZm_2005,
t_NGm_2005, t_ODm_2005, t_PDm_2005,t_PBm_2005,t_RJm_2005,t_SMm_2005,t_TNm_2005,t_TPm_2005,
t_UPm_2005, t_UKm_2005, t_WBm_2005],
"Female":[t_ANfm_2005, t_APfm_2005, t_ARPfm_2005, t_ASfm_2005, t_BHfm_2005, t_CHfm_2005, t_CTfm_2005, t_DNfm_2005,
t_DDfm_2005, t_DLfm_2005, t_GOAfm_2005, t_GJfm_2005, t_HRfm_2005, t_HPfm_2005,t_JKfm_2005, t_JHfm_2005,
t_KNfm_2005, t_KERfm_2005, t_LDfm_2005,t_MPfm_2005,t_MHfm_2005,t_MNfm_2005,t_MGfm_2005,t_MZfm_2005,
t_NGfm_2005, t_ODfm_2005, t_PDfm_2005,t_PBfm_2005,t_RJfm_2005,t_SMfm_2005,t_TNfm_2005,t_TPfm_2005,
t_UPfm_2005, t_UKfm_2005, t_WBfm_2005]
}
df_All_st_2005 = pd.DataFrame(df_state_2005)
df_All_st_2005
pivot_2005 = pd.pivot_table(df_All_st_2005, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2005
pivot_2005.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2005=[]
for i in cause_l_2005:
p=i/np.sum(cause_l_2005)
avg_2005_cause=p*100
cause_l_percent_2005.append(avg_2005_cause)
print(cause_l_percent_2005,end=" ")
np.max(cause_l_percent_2005) #Married
np.min(cause_l_percent_2005) #Ideological Causes/Hero Worshipping
state_s_2005_percent=[]
tot=np.sum(state_s_2005)
for i in state_s_2005:
xy=i/tot
avg_state_2005=xy*100
state_s_2005_percent.append(avg_state_2005)
print(state_s_2005_percent,end=" ")
np.max(state_s_2005_percent) #Maharashtra
np.min(state_s_2005_percent) #Lakshdweep
l_age_grp_2005=[s5_4,s5_5,s5_6,s5_7,s5_8,s5_54]
l_age_grp_2005
l_age_grp_2005_percent=[]
for i in l_age_grp_2005:
yz=i/s5_1
avg_2005_age_grp=yz*100
l_age_grp_2005_percent.append(avg_2005_age_grp)
l_age_grp_2005_percent
np.max(l_age_grp_2005_percent) #0-100+
np.min(l_age_grp_2005_percent) #0-14
total_male_percent_2005= (s5_2/s5_1)*100
total_male_percent_2005
total_female_percent_2005= (s5_3/s5_1)*100
total_female_percent_2005
df_2006 = suicide_df.loc[(suicide_df["Year"]==2006)]
df_2006
t2006_dcount = df_2006.loc[:,"Total"]
s6_1 = np.sum(t2006_dcount)
s6_1
male_2006 = df_2006.loc[(df_2006["Gender"]=="Male")]
male_2006
m2006_count = male_2006.loc[:,"Total"]
s6_2 = np.sum(m2006_count)
s6_2
female_2006 = df_2006.loc[(df_2006["Gender"]=="Female")]
female_2006
fm2006_count = female_2006.loc[:,"Total"]
s6_3 = np.sum(fm2006_count)
s6_3
df_age_d014_2006 = df_2006.loc[(df_2006["Age_group"]=="0-14")]
df_age_d014_2006
t_014_2006 = df_age_d014_2006.loc[:,"Total"]
s6_4 = np.sum(t_014_2006)
s6_4
df_age_d1529_2006 = df_2006.loc[(df_2006["Age_group"]=="15-29")]
df_age_d1529_2006
t_1529_2006 = df_age_d1529_2006.loc[:,"Total"]
s6_5 = np.sum(t_1529_2006)
s6_5
df_age_d3044_2006 = df_2006.loc[(df_2006["Age_group"]=="30-44")]
df_age_d3044_2006
t_3044_2006 = df_age_d3044_2006.loc[:,"Total"]
s6_6 = np.sum(t_3044_2006)
s6_6
df_age_d4559_2006 = df_2006.loc[(df_2006["Age_group"]=="45-59")]
df_age_d4559_2006
t_4559_2006 = df_age_d4559_2006.loc[:,"Total"]
s6_7 = np.sum(t_4559_2006)
s6_7
df_age_d60_2006 = df_2006.loc[(df_2006["Age_group"]=="60+")]
df_age_d60_2006
t_60_2006 = df_age_d60_2006.loc[:,"Total"]
s6_8 = np.sum(t_60_2006)
s6_8
df_age_d0100_2006 = df_2006.loc[(df_2006["Age_group"]=="0-100+")]
df_age_d0100_2006
t_0100_2006 = df_age_d0100_2006.loc[:,"Total"]
s6_54 = np.sum(t_0100_2006)
s6_54
df_014m_2006 = df_age_d014_2006.loc[(df_age_d014_2006["Gender"]=="Male")]
df_014m_2006
t_014m_2006 = df_014m_2006.loc[:,"Total"]
s6_9 = np.sum(t_014m_2006)
s6_9
df_014fm_2006 = df_age_d014_2006.loc[(df_age_d014_2006["Gender"]=="Female")]
df_014fm_2006
t_014fm_2006 = df_014fm_2006.loc[:,"Total"]
s6_10 = np.sum(t_014fm_2006)
s6_10
df_1529m_2006 = df_age_d1529_2006.loc[(df_age_d1529_2006["Gender"]=="Male")]
df_1529m_2006
t_1529m_2006 = df_1529m_2006.loc[:,"Total"]
s6_11 = np.sum(t_1529m_2006)
s6_11
df_1529fm_2006 = df_age_d1529_2006.loc[(df_age_d1529_2006["Gender"]=="Female")]
df_1529fm_2006
t_1529fm_2006 = df_1529fm_2006.loc[:,"Total"]
s6_12 = np.sum(t_1529fm_2006)
s6_12
df_3044m_2006 = df_age_d3044_2006.loc[(df_age_d3044_2006["Gender"]=="Male")]
df_3044m_2006
t_3044m_2006 = df_3044m_2006.loc[:,"Total"]
s6_13 = np.sum(t_3044m_2006)
s6_13
df_3044fm_2006 = df_age_d3044_2006.loc[(df_age_d3044_2006["Gender"]=="Female")]
df_3044fm_2006
t_3044fm_2006 = df_3044fm_2006.loc[:,"Total"]
s6_14 = np.sum(t_3044fm_2006)
s6_14
df_4559m_2006 = df_age_d4559_2006.loc[(df_age_d4559_2006["Gender"]=="Male")]
df_4559m_2006
t_4559m_2006 = df_4559m_2006.loc[:,"Total"]
s6_15 = np.sum(t_4559m_2006)
s6_15
df_4559fm_2006 = df_age_d4559_2006.loc[(df_age_d4559_2006["Gender"]=="Female")]
df_4559fm_2006
t_4559fm_2006 = df_4559fm_2006.loc[:,"Total"]
s6_16 = np.sum(t_4559fm_2006)
s6_16
df_60m_2006 = df_age_d60_2006.loc[(df_age_d60_2006["Gender"]=="Male")]
df_60m_2006
t_60m_2006 = df_60m_2006.loc[:,"Total"]
s6_17 = np.sum(t_60m_2006)
s6_17
df_60fm_2006 = df_age_d60_2006.loc[(df_age_d60_2006["Gender"]=="Female")]
df_60fm_2006
t_60fm_2006 = df_60fm_2006.loc[:,"Total"]
s6_18 = np.sum(t_60fm_2006)
s6_18
df_0100fm_2006 = df_age_d0100_2006.loc[(df_age_d0100_2006["Gender"]=="Female")]
df_0100fm_2006
t_0100fm_2006 = df_0100fm_2006.loc[:,"Total"]
s6_55 = np.sum(t_0100fm_2006)
s6_55
df_0100m_2006 = df_age_d0100_2006.loc[(df_age_d0100_2006["Gender"]=="Male")]
df_0100m_2006
t_0100m_2006 = df_0100m_2006.loc[:,"Total"]
s6_56 = np.sum(t_0100m_2006)
s6_56
df_st_AN_2006 = df_2006.loc[(df_2006["State"]=="A & N ISLANDS")]
df_st_AN_2006
t_AN_2006 = df_st_AN_2006.loc[:,"Total"]
s6_19 = np.sum(t_AN_2006)
s6_19
df_st_AP_2006 = df_2006.loc[(df_2006["State"]=="ANDHRA PRADESH")]
df_st_AP_2006
t_AP_2006 = df_st_AP_2006.loc[:,"Total"]
s6_20 = np.sum(t_AP_2006)
s6_20
df_st_ARP_2006 = df_2006.loc[(df_2006["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2006
t_ARP_2006 = df_st_ARP_2006.loc[:,"Total"]
s6_21 = np.sum(t_ARP_2006)
s6_21
df_st_AS_2006 = df_2006.loc[(df_2006["State"]=="ASSAM")]
df_st_AS_2006
t_AS_2006 = df_st_AS_2006.loc[:,"Total"]
s6_22 = np.sum(t_AS_2006)
s6_22
df_st_BH_2006 = df_2006.loc[(df_2006["State"]=="BIHAR")]
df_st_BH_2006
t_BH_2006 = df_st_BH_2006.loc[:,"Total"]
s6_23 = np.sum(t_BH_2006)
s6_23
df_st_CH_2006 = df_2006.loc[(df_2006["State"]=="CHANDIGARH")]
df_st_CH_2006
t_CH_2006 = df_st_CH_2006.loc[:,"Total"]
s6_24 = np.sum(t_CH_2006)
s6_24
df_st_CT_2006 = df_2006.loc[(df_2006["State"]=="CHHATTISGARH")]
df_st_CT_2006
t_CT_2006 = df_st_CT_2006.loc[:,"Total"]
s6_25 = np.sum(t_CT_2006)
s6_25
df_st_DN_2006 = df_2006.loc[(df_2006["State"]=="D & N HAVELI")]
df_st_DN_2006
t_DN_2006 = df_st_DN_2006.loc[:,"Total"]
s6_26 = np.sum(t_DN_2006)
s6_26
df_st_DD_2006 = df_2006.loc[(df_2006["State"]=="DAMAN & DIU")]
df_st_DD_2006
t_DD_2006 = df_st_DD_2006.loc[:,"Total"]
s6_27 = np.sum(t_DD_2006)
s6_27
df_st_DL_2006 = df_2006.loc[(df_2006["State"]=="DELHI (UT)")]
df_st_DL_2006
t_DL_2006 = df_st_DL_2006.loc[:,"Total"]
s6_28 = np.sum(t_DL_2006)
s6_28
df_st_GOA_2006 = df_2006.loc[(df_2006["State"]=="GOA")]
df_st_GOA_2006
t_GOA_2006 = df_st_GOA_2006.loc[:,"Total"]
s6_29 = np.sum(t_GOA_2006)
s6_29
df_st_GJ_2006 = df_2006.loc[(df_2006["State"]=="GUJARAT")]
df_st_GJ_2006
t_GJ_2006 = df_st_GJ_2006.loc[:,"Total"]
s6_30 = np.sum(t_GJ_2006)
s6_30
df_st_HR_2006 = df_2006.loc[(df_2006["State"]=="HARYANA")]
df_st_HR_2006
t_HR_2006 = df_st_HR_2006.loc[:,"Total"]
s6_31 = np.sum(t_HR_2006)
s6_31
df_st_HP_2006 = df_2006.loc[(df_2006["State"]=="HIMACHAL PRADESH")]
df_st_HP_2006
t_HP_2006 = df_st_HP_2006.loc[:,"Total"]
s6_32 = np.sum(t_HP_2006)
s6_32
df_st_JK_2006 = df_2006.loc[(df_2006["State"]=="JAMMU & KASHMIR")]
df_st_JK_2006
t_JK_2006 = df_st_JK_2006.loc[:,"Total"]
s6_33 = np.sum(t_JK_2006)
s6_33
df_st_JH_2006 = df_2006.loc[(df_2006["State"]=="JHARKHAND")]
df_st_JH_2006
t_JH_2006 = df_st_JH_2006.loc[:,"Total"]
s6_34 = np.sum(t_JH_2006)
s6_34
df_st_KN_2006 = df_2006.loc[(df_2006["State"]=="KARNATAKA")]
df_st_KN_2006
t_KN_2006 = df_st_KN_2006.loc[:,"Total"]
s6_35 = np.sum(t_KN_2006)
s6_35
df_st_KER_2006 = df_2006.loc[(df_2006["State"]=="KERALA")]
df_st_KER_2006
t_KER_2006 = df_st_KER_2006.loc[:,"Total"]
s6_36 = np.sum(t_KER_2006)
s6_36
df_st_LD_2006 = df_2006.loc[(df_2006["State"]=="LAKSHADWEEP")]
df_st_LD_2006
t_LD_2006 = df_st_LD_2006.loc[:,"Total"]
s6_37 = np.sum(t_LD_2006)
s6_37
df_st_MP_2006 = df_2006.loc[(df_2006["State"]=="MADHYA PRADESH")]
df_st_MP_2006
t_MP_2006 = df_st_MP_2006.loc[:,"Total"]
s6_38 = np.sum(t_MP_2006)
s6_38
df_st_MH_2006 = df_2006.loc[(df_2006["State"]=="MAHARASHTRA")]
df_st_MH_2006
t_MH_2006 = df_st_MH_2006.loc[:,"Total"]
s6_39 = np.sum(t_MH_2006)
s6_39
df_st_MN_2006 = df_2006.loc[(df_2006["State"]=="MANIPUR")]
df_st_MN_2006
t_MN_2006 = df_st_MN_2006.loc[:,"Total"]
s6_40 = np.sum(t_MN_2006)
s6_40
df_st_MG_2006 = df_2006.loc[(df_2006["State"]=="MEGHALAYA")]
df_st_MG_2006
t_MG_2006 = df_st_MG_2006.loc[:,"Total"]
s6_41 = np.sum(t_MG_2006)
s6_41
df_st_MZ_2006 = df_2006.loc[(df_2006["State"]=="MIZORAM")]
df_st_MZ_2006
t_MN_2006 = df_st_MN_2006.loc[:,"Total"]
s6_42 = np.sum(t_MN_2006)
s6_42
df_st_NG_2006 = df_2006.loc[(df_2006["State"]=="NAGALAND")]
df_st_NG_2006
t_NG_2006 = df_st_NG_2006.loc[:,"Total"]
s6_43 = np.sum(t_NG_2006)
s6_43
df_st_OD_2006 = df_2006.loc[(df_2006["State"]=="ODISHA")]
df_st_OD_2006
t_OD_2006 = df_st_OD_2006.loc[:,"Total"]
s6_44 = np.sum(t_OD_2006)
s6_44
df_st_PD_2006 = df_2006.loc[(df_2006["State"]=="PUDUCHERRY")]
df_st_PD_2006
t_PD_2006 = df_st_PD_2006.loc[:,"Total"]
s6_45 = np.sum(t_PD_2006)
s6_45
df_st_PB_2006 = df_2006.loc[(df_2006["State"]=="PUNJAB")]
df_st_PB_2006
t_PB_2006 = df_st_PB_2006.loc[:,"Total"]
s6_46 = np.sum(t_PB_2006)
s6_46
df_st_RJ_2006 = df_2006.loc[(df_2006["State"]=="RAJASTHAN")]
df_st_RJ_2006
t_RJ_2006 = df_st_RJ_2006.loc[:,"Total"]
s6_47 = np.sum(t_RJ_2006)
s6_47
df_st_SM_2006 = df_2006.loc[(df_2006["State"]=="SIKKIM")]
df_st_SM_2006
t_SM_2006 = df_st_SM_2006.loc[:,"Total"]
s6_48 = np.sum(t_SM_2006)
s6_48
df_st_TN_2006 = df_2006.loc[(df_2006["State"]=="TAMIL NADU")]
df_st_TN_2006
t_TN_2006 = df_st_TN_2006.loc[:,"Total"]
s6_49 = np.sum(t_TN_2006)
s6_49
df_st_TP_2006 = df_2006.loc[(df_2006["State"]=="TRIPURA")]
df_st_TP_2006
t_TP_2006 = df_st_TP_2006.loc[:,"Total"]
s6_50 = np.sum(t_TP_2006)
s6_50
df_st_UP_2006 = df_2006.loc[(df_2006["State"]=="UTTAR PRADESH")]
df_st_UP_2006
t_UP_2006 = df_st_UP_2006.loc[:,"Total"]
s6_51 = np.sum(t_UP_2006)
s6_51
df_st_UK_2006 = df_2006.loc[(df_2006["State"]=="UTTARAKHAND")]
df_st_UK_2006
t_UK_2006 = df_st_UK_2006.loc[:,"Total"]
s6_52 = np.sum(t_UK_2006)
s6_52
df_st_WB_2006 = df_2006.loc[(df_2006["State"]=="WEST BENGAL")]
df_st_WB_2006
t_WB_2006 = df_st_WB_2006.loc[:,"Total"]
s6_53 = np.sum(t_WB_2006)
s6_53
t_ANm_2006 = np.sum(df_st_AN_2006.where(df_st_AN_2006["Gender"]=="Male")["Total"])
t_ANm_2006
t_ANfm_2006 = np.sum(df_st_AN_2006.where(df_st_AN_2006["Gender"]=="Female")["Total"])
t_ANfm_2006
t_APm_2006 = np.sum(df_st_AP_2006.where(df_st_AP_2006["Gender"]=="Male")["Total"])
t_APm_2006
t_APfm_2006 = np.sum(df_st_AP_2006.where(df_st_AP_2006["Gender"]=="Female")["Total"])
t_APfm_2006
t_ARPm_2006 = np.sum(df_st_ARP_2006.where(df_st_ARP_2006["Gender"]=="Male")["Total"])
t_ARPm_2006
t_ARPfm_2006 = np.sum(df_st_ARP_2006.where(df_st_ARP_2006["Gender"]=="Female")["Total"])
t_ARPfm_2006
t_ASm_2006 = np.sum(df_st_AS_2006.where(df_st_AS_2006["Gender"]=="Male")["Total"])
t_ASm_2006
t_ASfm_2006 = np.sum(df_st_AS_2006.where(df_st_AS_2006["Gender"]=="Female")["Total"])
t_ASfm_2006
t_BHm_2006 = np.sum(df_st_BH_2006.where(df_st_BH_2006["Gender"]=="Male")["Total"])
t_BHm_2006
t_BHfm_2006 = np.sum(df_st_BH_2006.where(df_st_BH_2006["Gender"]=="Female")["Total"])
t_BHfm_2006
t_CHm_2006 = np.sum(df_st_CH_2006.where(df_st_CH_2006["Gender"]=="Male")["Total"])
t_CHm_2006
t_CHfm_2006 = np.sum(df_st_CH_2006.where(df_st_CH_2006["Gender"]=="Female")["Total"])
t_CHfm_2006
t_CTm_2006 = np.sum(df_st_CT_2006.where(df_st_CT_2006["Gender"]=="Male")["Total"])
t_CTm_2006
t_CTfm_2006 = np.sum(df_st_CT_2006.where(df_st_CT_2006["Gender"]=="Female")["Total"])
t_CTfm_2006
t_DNm_2006 = np.sum(df_st_DN_2006.where(df_st_DN_2006["Gender"]=="Male")["Total"])
t_DNm_2006
t_DNfm_2006 = np.sum(df_st_DN_2006.where(df_st_DN_2006["Gender"]=="Female")["Total"])
t_DNfm_2006
t_DDm_2006 = np.sum(df_st_DD_2006.where(df_st_DD_2006["Gender"]=="Male")["Total"])
t_DDm_2006
t_DDfm_2006 = np.sum(df_st_DD_2006.where(df_st_DD_2006["Gender"]=="Female")["Total"])
t_DDfm_2006
t_DLm_2006 = np.sum(df_st_DL_2006.where(df_st_DL_2006["Gender"]=="Male")["Total"])
t_DLm_2006
t_DLfm_2006 = np.sum(df_st_DL_2006.where(df_st_DL_2006["Gender"]=="Female")["Total"])
t_DLfm_2006
t_GOAm_2006 = np.sum(df_st_GOA_2006.where(df_st_GOA_2006["Gender"]=="Male")["Total"])
t_GOAm_2006
t_GOAfm_2006 = np.sum(df_st_GOA_2006.where(df_st_GOA_2006["Gender"]=="Female")["Total"])
t_GOAfm_2006
t_GJm_2006 = np.sum(df_st_GJ_2006.where(df_st_GJ_2006["Gender"]=="Male")["Total"])
t_GJm_2006
t_GJfm_2006 = np.sum(df_st_GJ_2006.where(df_st_GJ_2006["Gender"]=="Female")["Total"])
t_GJfm_2006
t_HRm_2006 = np.sum(df_st_HR_2006.where(df_st_HR_2006["Gender"]=="Male")["Total"])
t_HRm_2006
t_HRfm_2006 = np.sum(df_st_HR_2006.where(df_st_HR_2006["Gender"]=="Female")["Total"])
t_HRfm_2006
t_HPm_2006 = np.sum(df_st_HP_2006.where(df_st_HP_2006["Gender"]=="Male")["Total"])
t_HPm_2006
t_HPfm_2006 = np.sum(df_st_HP_2006.where(df_st_HP_2006["Gender"]=="Female")["Total"])
t_HPfm_2006
t_JKm_2006 = np.sum(df_st_JK_2006.where(df_st_JK_2006["Gender"]=="Male")["Total"])
t_JKm_2006
t_JKfm_2006 = np.sum(df_st_JK_2006.where(df_st_JK_2006["Gender"]=="Female")["Total"])
t_JKfm_2006
t_JHm_2006 = np.sum(df_st_JH_2006.where(df_st_JH_2006["Gender"]=="Male")["Total"])
t_JHm_2006
t_JHfm_2006 = np.sum(df_st_JH_2006.where(df_st_JH_2006["Gender"]=="Female")["Total"])
t_JHfm_2006
t_KNm_2006 = np.sum(df_st_KN_2006.where(df_st_KN_2006["Gender"]=="Male")["Total"])
t_KNm_2006
t_KNfm_2006 = np.sum(df_st_KN_2006.where(df_st_KN_2006["Gender"]=="Female")["Total"])
t_KNfm_2006
t_KERm_2006 = np.sum(df_st_KER_2006.where(df_st_KER_2006["Gender"]=="Male")["Total"])
t_KERm_2006
t_KERfm_2006 = np.sum(df_st_KER_2006.where(df_st_KER_2006["Gender"]=="Female")["Total"])
t_KERfm_2006
t_LDm_2006 = np.sum(df_st_LD_2006.where(df_st_LD_2006["Gender"]=="Male")["Total"])
t_LDm_2006
t_LDfm_2006 = np.sum(df_st_LD_2006.where(df_st_LD_2006["Gender"]=="Female")["Total"])
t_LDfm_2006
t_MPm_2006 = np.sum(df_st_MP_2006.where(df_st_MP_2006["Gender"]=="Male")["Total"])
t_MPm_2006
t_MPfm_2006 = np.sum(df_st_MP_2006.where(df_st_MP_2006["Gender"]=="Female")["Total"])
t_MPfm_2006
t_MHm_2006 = np.sum(df_st_MH_2006.where(df_st_MH_2006["Gender"]=="Male")["Total"])
t_MHm_2006
t_MHfm_2006 = np.sum(df_st_MH_2006.where(df_st_MH_2006["Gender"]=="Female")["Total"])
t_MHfm_2006
t_MNm_2006 = np.sum(df_st_MN_2006.where(df_st_MN_2006["Gender"]=="Male")["Total"])
t_MNm_2006
t_MNfm_2006 = np.sum(df_st_MN_2006.where(df_st_MN_2006["Gender"]=="Female")["Total"])
t_MNfm_2006
t_MGm_2006 = np.sum(df_st_MG_2006.where(df_st_MG_2006["Gender"]=="Male")["Total"])
t_MGm_2006
t_MGfm_2006 = np.sum(df_st_MG_2006.where(df_st_MG_2006["Gender"]=="Female")["Total"])
t_MGfm_2006
t_MZm_2006 = np.sum(df_st_MZ_2006.where(df_st_MZ_2006["Gender"]=="Male")["Total"])
t_MZm_2006
t_MZfm_2006 = np.sum(df_st_MZ_2006.where(df_st_MZ_2006["Gender"]=="Female")["Total"])
t_MZfm_2006
t_NGm_2006 = np.sum(df_st_NG_2006.where(df_st_NG_2006["Gender"]=="Male")["Total"])
t_NGm_2006
t_NGfm_2006 = np.sum(df_st_NG_2006.where(df_st_NG_2006["Gender"]=="Female")["Total"])
t_MGfm_2006
t_ODm_2006 = np.sum(df_st_OD_2006.where(df_st_OD_2006["Gender"]=="Male")["Total"])
t_ODm_2006
t_ODfm_2006 = np.sum(df_st_OD_2006.where(df_st_OD_2006["Gender"]=="Female")["Total"])
t_ODfm_2006
t_PDm_2006 = np.sum(df_st_PD_2006.where(df_st_PD_2006["Gender"]=="Male")["Total"])
t_PDm_2006
t_PDfm_2006 = np.sum(df_st_PD_2006.where(df_st_PD_2006["Gender"]=="Female")["Total"])
t_PDfm_2006
t_PBm_2006 = np.sum(df_st_PB_2006.where(df_st_PB_2006["Gender"]=="Male")["Total"])
t_PBm_2006
t_PBfm_2006 = np.sum(df_st_PB_2006.where(df_st_PB_2006["Gender"]=="Female")["Total"])
t_PBfm_2006
t_RJm_2006 = np.sum(df_st_RJ_2006.where(df_st_RJ_2006["Gender"]=="Male")["Total"])
t_RJm_2006
t_RJfm_2006 = np.sum(df_st_RJ_2006.where(df_st_RJ_2006["Gender"]=="Female")["Total"])
t_RJfm_2006
t_SMm_2006 = np.sum(df_st_SM_2006.where(df_st_SM_2006["Gender"]=="Male")["Total"])
t_SMm_2006
t_SMfm_2006 = np.sum(df_st_SM_2006.where(df_st_SM_2006["Gender"]=="Female")["Total"])
t_SMfm_2006
t_TNm_2006 = np.sum(df_st_TN_2006.where(df_st_TN_2006["Gender"]=="Male")["Total"])
t_TNm_2006
t_TNfm_2006 = np.sum(df_st_TN_2006.where(df_st_TN_2006["Gender"]=="Female")["Total"])
t_TNfm_2006
t_TPm_2006 = np.sum(df_st_TP_2006.where(df_st_TP_2006["Gender"]=="Male")["Total"])
t_TPm_2006
t_TPfm_2006 = np.sum(df_st_TP_2006.where(df_st_TP_2006["Gender"]=="Female")["Total"])
t_TPfm_2006
t_UPm_2006 = np.sum(df_st_UP_2006.where(df_st_UP_2006["Gender"]=="Male")["Total"])
t_UPm_2006
t_UPfm_2006 = np.sum(df_st_UP_2006.where(df_st_UP_2006["Gender"]=="Female")["Total"])
t_UPfm_2006
t_UKm_2006 = np.sum(df_st_UK_2006.where(df_st_UK_2006["Gender"]=="Male")["Total"])
t_UKm_2006
t_UKfm_2006 = np.sum(df_st_UK_2006.where(df_st_UK_2006["Gender"]=="Female")["Total"])
t_UKfm_2006
t_WBm_2006 = np.sum(df_st_WB_2006.where(df_st_WB_2006["Gender"]=="Male")["Total"])
t_WBm_2006
t_WBfm_2006 = np.sum(df_st_WB_2006.where(df_st_WB_2006["Gender"]=="Female")["Total"])
t_WBfm_2006
l_2006=list(df_2006.loc[:,"Type"].unique())
l_2006.sort()
print(l_2006,end=" ")
cause_l_2006=[]
for i in l_2006:
rough= np.sum(df_2006.where(df_2006["Type"]==i)["Total"])
cause_l_2006.append(rough)
print(cause_l_2006,end=" ")
x1_2006 = set(df_2006.loc[:,"State"])
x1_2006
len(x1_2006)
cause_df_2006 = pd.DataFrame(cause_l_2006,l_2006)
cause_df_2006.reset_index()
cause_df_2006.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2006",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2006=list(df_2006.loc[:,"State"].unique())
s_2006.sort()
print(s_2006,end=" ")
state_s_2006 = [s6_19,s6_20,s6_21,s6_22,s6_23,s6_24,s6_25,s6_26,s6_27,s6_28,s6_29,s6_30,s6_31,s6_32,s6_33,s6_34,
s6_35,s6_36,s6_37,s6_38,s6_39,s6_40,s6_41,s6_42,s6_43,s6_44,s6_45,s6_46,s6_47,s6_48,s6_49,s6_50,
s6_51,s6_52,s6_53]
print(state_s_2006,end=" ")
state_m_2006=[t_ANm_2006, t_APm_2006, t_ARPm_2006, t_ASm_2006, t_BHm_2006, t_CHm_2006, t_CTm_2006, t_DNm_2006,
t_DDm_2006, t_DLm_2006, t_GOAm_2006, t_GJm_2006, t_HRm_2006, t_HPm_2006,t_JKm_2006, t_JHm_2006,
t_KNm_2006, t_KERm_2006, t_LDm_2006,t_MPm_2006,t_MHm_2006,t_MNm_2006,t_MGm_2006,t_MZm_2006,
t_NGm_2006, t_ODm_2006, t_PDm_2006,t_PBm_2006,t_RJm_2006,t_SMm_2006,t_TNm_2006,t_TPm_2006,
t_UPm_2006, t_UKm_2006, t_WBm_2006]
print(state_m_2006,end=" ")
state_fm_2006=[t_ANfm_2006, t_APfm_2006, t_ARPfm_2006, t_ASfm_2006, t_BHfm_2006, t_CHfm_2006, t_CTfm_2006, t_DNfm_2006,
t_DDfm_2006, t_DLfm_2006, t_GOAfm_2006, t_GJfm_2006, t_HRfm_2006, t_HPfm_2006,t_JKfm_2006, t_JHfm_2006,
t_KNfm_2006, t_KERfm_2006, t_LDfm_2006,t_MPfm_2006,t_MHfm_2006,t_MNfm_2006,t_MGfm_2006,t_MZfm_2006,
t_NGfm_2006, t_ODfm_2006, t_PDfm_2006,t_PBfm_2006,t_RJfm_2006,t_SMfm_2006,t_TNfm_2006,t_TPfm_2006,
t_UPfm_2006, t_UKfm_2006, t_WBfm_2006]
print(state_fm_2006,end=" ")
df_state_2006 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s6_19,s6_20,s6_21,s6_22,s6_23,s6_24,s6_25,s6_26,s6_27,s6_28,s6_29,s6_30,s6_31,s6_32,s6_33,s6_34,
s6_35,s6_36,s6_37,s6_38,s6_39,s6_40,s6_41,s6_42,s6_43,s6_44,s6_45,s6_46,s6_47,s6_48,s6_49,s6_50,
s6_51,s6_52,s6_53],
"Male":[t_ANm_2006, t_APm_2006, t_ARPm_2006, t_ASm_2006, t_BHm_2006, t_CHm_2006, t_CTm_2006, t_DNm_2006,
t_DDm_2006, t_DLm_2006, t_GOAm_2006, t_GJm_2006, t_HRm_2006, t_HPm_2006,t_JKm_2006, t_JHm_2006,
t_KNm_2006, t_KERm_2006, t_LDm_2006,t_MPm_2006,t_MHm_2006,t_MNm_2006,t_MGm_2006,t_MZm_2006,
t_NGm_2006, t_ODm_2006, t_PDm_2006,t_PBm_2006,t_RJm_2006,t_SMm_2006,t_TNm_2006,t_TPm_2006,
t_UPm_2006, t_UKm_2006, t_WBm_2006],
"Female":[t_ANfm_2006, t_APfm_2006, t_ARPfm_2006, t_ASfm_2006, t_BHfm_2006, t_CHfm_2006, t_CTfm_2006, t_DNfm_2006,
t_DDfm_2006, t_DLfm_2006, t_GOAfm_2006, t_GJfm_2006, t_HRfm_2006, t_HPfm_2006,t_JKfm_2006, t_JHfm_2006,
t_KNfm_2006, t_KERfm_2006, t_LDfm_2006,t_MPfm_2006,t_MHfm_2006,t_MNfm_2006,t_MGfm_2006,t_MZfm_2006,
t_NGfm_2006, t_ODfm_2006, t_PDfm_2006,t_PBfm_2006,t_RJfm_2006,t_SMfm_2006,t_TNfm_2006,t_TPfm_2006,
t_UPfm_2006, t_UKfm_2006, t_WBfm_2006]
}
df_All_st_2006 = pd.DataFrame(df_state_2006)
df_All_st_2006
pivot_2006 = pd.pivot_table(df_All_st_2006, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2006
pivot_2006.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2006=[]
for i in cause_l_2006:
p=i/np.sum(cause_l_2006)
avg_2006_cause=p*100
cause_l_percent_2006.append(avg_2006_cause)
print(cause_l_percent_2006,end=" ")
np.max(cause_l_percent_2006) #Married
np.min(cause_l_percent_2006) #Ideological Causes/Hero Worshipping
state_s_2006_percent=[]
tot=np.sum(state_s_2006)
for i in state_s_2006:
xy=i/tot
avg_state_2006=xy*100
state_s_2006_percent.append(avg_state_2006)
print(state_s_2006_percent,end=" ")
np.max(state_s_2006_percent) #Maharashtra
np.min(state_s_2006_percent) #Lakshdweep
l_age_grp_2006=[s6_4,s6_5,s6_6,s6_7,s6_8,s6_54]
l_age_grp_2006
l_age_grp_2006_percent=[]
for i in l_age_grp_2006:
yz=i/s6_1
avg_2006_age_grp=yz*100
l_age_grp_2006_percent.append(avg_2006_age_grp)
l_age_grp_2006_percent
np.max(l_age_grp_2006_percent) #0-100+
np.min(l_age_grp_2006_percent) #0-14
total_male_percent_2006= (s6_2/s6_1)*100
total_male_percent_2006
total_female_percent_2006= (s6_3/s6_1)*100
total_female_percent_2006
df_2007 = suicide_df.loc[(suicide_df["Year"]==2007)]
df_2007
t2007_dcount = df_2007.loc[:,"Total"]
s7_1 = np.sum(t2007_dcount)
s7_1
male_2007 = df_2007.loc[(df_2007["Gender"]=="Male")]
male_2007
m2007_count = male_2007.loc[:,"Total"]
s7_2 = np.sum(m2007_count)
s7_2
female_2007 = df_2007.loc[(df_2007["Gender"]=="Female")]
female_2007
fm2007_count = female_2007.loc[:,"Total"]
s7_3 = np.sum(fm2007_count)
s7_3
df_age_d014_2007 = df_2007.loc[(df_2007["Age_group"]=="0-14")]
df_age_d014_2007
t_014_2007 = df_age_d014_2007.loc[:,"Total"]
s7_4 = np.sum(t_014_2007)
s7_4
df_age_d1529_2007 = df_2007.loc[(df_2007["Age_group"]=="15-29")]
df_age_d1529_2007
t_1529_2007 = df_age_d1529_2007.loc[:,"Total"]
s7_5 = np.sum(t_1529_2007)
s7_5
df_age_d3044_2007 = df_2007.loc[(df_2007["Age_group"]=="30-44")]
df_age_d3044_2007
t_3044_2007 = df_age_d3044_2007.loc[:,"Total"]
s7_6 = np.sum(t_3044_2007)
s7_6
df_age_d4559_2007 = df_2007.loc[(df_2007["Age_group"]=="45-59")]
df_age_d4559_2007
t_4559_2007 = df_age_d4559_2007.loc[:,"Total"]
s7_7 = np.sum(t_4559_2007)
s7_7
df_age_d60_2007 = df_2007.loc[(df_2007["Age_group"]=="60+")]
df_age_d60_2007
t_60_2007 = df_age_d60_2007.loc[:,"Total"]
s7_8 = np.sum(t_60_2007)
s7_8
df_age_d0100_2007 = df_2007.loc[(df_2007["Age_group"]=="0-100+")]
df_age_d0100_2007
t_0100_2007 = df_age_d0100_2007.loc[:,"Total"]
s7_54 = np.sum(t_0100_2007)
s7_54
df_014m_2007 = df_age_d014_2007.loc[(df_age_d014_2007["Gender"]=="Male")]
df_014m_2007
t_014m_2007 = df_014m_2007.loc[:,"Total"]
s7_9 = np.sum(t_014m_2007)
s7_9
df_014fm_2007 = df_age_d014_2007.loc[(df_age_d014_2007["Gender"]=="Female")]
df_014fm_2007
t_014fm_2007 = df_014fm_2007.loc[:,"Total"]
s7_10 = np.sum(t_014fm_2007)
s7_10
df_1529m_2007 = df_age_d1529_2007.loc[(df_age_d1529_2007["Gender"]=="Male")]
df_1529m_2007
t_1529m_2007 = df_1529m_2007.loc[:,"Total"]
s7_11 = np.sum(t_1529m_2007)
s7_11
df_1529fm_2007 = df_age_d1529_2007.loc[(df_age_d1529_2007["Gender"]=="Female")]
df_1529fm_2007
t_1529fm_2007 = df_1529fm_2007.loc[:,"Total"]
s7_12 = np.sum(t_1529fm_2007)
s7_12
df_3044m_2007 = df_age_d3044_2007.loc[(df_age_d3044_2007["Gender"]=="Male")]
df_3044m_2007
t_3044m_2007 = df_3044m_2007.loc[:,"Total"]
s7_13 = np.sum(t_3044m_2007)
s7_13
df_3044fm_2007 = df_age_d3044_2007.loc[(df_age_d3044_2007["Gender"]=="Female")]
df_3044fm_2007
t_3044fm_2007 = df_3044fm_2007.loc[:,"Total"]
s7_14 = np.sum(t_3044fm_2007)
s7_14
df_4559m_2007 = df_age_d4559_2007.loc[(df_age_d4559_2007["Gender"]=="Male")]
df_4559m_2007
t_4559m_2007 = df_4559m_2007.loc[:,"Total"]
s7_15 = np.sum(t_4559m_2007)
s7_15
df_4559fm_2007 = df_age_d4559_2007.loc[(df_age_d4559_2007["Gender"]=="Female")]
df_4559fm_2007
t_4559fm_2007 = df_4559fm_2007.loc[:,"Total"]
s7_16 = np.sum(t_4559fm_2007)
s7_16
df_60m_2007 = df_age_d60_2007.loc[(df_age_d60_2007["Gender"]=="Male")]
df_60m_2007
t_60m_2007 = df_60m_2007.loc[:,"Total"]
s7_17 = np.sum(t_60m_2007)
s7_17
df_60fm_2007 = df_age_d60_2007.loc[(df_age_d60_2007["Gender"]=="Female")]
df_60fm_2007
t_60fm_2007 = df_60fm_2007.loc[:,"Total"]
s7_18 = np.sum(t_60fm_2007)
s7_18
df_0100fm_2007 = df_age_d0100_2007.loc[(df_age_d0100_2007["Gender"]=="Female")]
df_0100fm_2007
t_0100fm_2007 = df_0100fm_2007.loc[:,"Total"]
s7_55 = np.sum(t_0100fm_2007)
s7_55
df_0100m_2007 = df_age_d0100_2007.loc[(df_age_d0100_2007["Gender"]=="Male")]
df_0100m_2007
t_0100m_2007 = df_0100m_2007.loc[:,"Total"]
s7_56 = np.sum(t_0100m_2007)
s7_56
df_st_AN_2007 = df_2007.loc[(df_2007["State"]=="A & N ISLANDS")]
df_st_AN_2007
t_AN_2007 = df_st_AN_2007.loc[:,"Total"]
s7_19 = np.sum(t_AN_2007)
s7_19
df_st_AP_2007 = df_2007.loc[(df_2007["State"]=="ANDHRA PRADESH")]
df_st_AP_2007
t_AP_2007 = df_st_AP_2007.loc[:,"Total"]
s7_20 = np.sum(t_AP_2007)
s7_20
df_st_ARP_2007 = df_2007.loc[(df_2007["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2007
t_ARP_2007 = df_st_ARP_2007.loc[:,"Total"]
s7_21 = np.sum(t_ARP_2007)
s7_21
df_st_AS_2007 = df_2007.loc[(df_2007["State"]=="ASSAM")]
df_st_AS_2007
t_AS_2007 = df_st_AS_2007.loc[:,"Total"]
s7_22 = np.sum(t_AS_2007)
s7_22
df_st_BH_2007 = df_2007.loc[(df_2007["State"]=="BIHAR")]
df_st_BH_2007
t_BH_2007 = df_st_BH_2007.loc[:,"Total"]
s7_23 = np.sum(t_BH_2007)
s7_23
df_st_CH_2007 = df_2007.loc[(df_2007["State"]=="CHANDIGARH")]
df_st_CH_2007
t_CH_2007 = df_st_CH_2007.loc[:,"Total"]
s7_24 = np.sum(t_CH_2007)
s7_24
df_st_CT_2007 = df_2007.loc[(df_2007["State"]=="CHHATTISGARH")]
df_st_CT_2007
t_CT_2007 = df_st_CT_2007.loc[:,"Total"]
s7_25 = np.sum(t_CT_2007)
s7_25
df_st_DN_2007 = df_2007.loc[(df_2007["State"]=="D & N HAVELI")]
df_st_DN_2007
t_DN_2007 = df_st_DN_2007.loc[:,"Total"]
s7_26 = np.sum(t_DN_2007)
s7_26
df_st_DD_2007 = df_2007.loc[(df_2007["State"]=="DAMAN & DIU")]
df_st_DD_2007
t_DD_2007 = df_st_DD_2007.loc[:,"Total"]
s7_27 = np.sum(t_DD_2007)
s7_27
df_st_DL_2007 = df_2007.loc[(df_2007["State"]=="DELHI (UT)")]
df_st_DL_2007
t_DL_2007 = df_st_DL_2007.loc[:,"Total"]
s7_28 = np.sum(t_DL_2007)
s7_28
df_st_GOA_2007 = df_2007.loc[(df_2007["State"]=="GOA")]
df_st_GOA_2007
t_GOA_2007 = df_st_GOA_2007.loc[:,"Total"]
s7_29 = np.sum(t_GOA_2007)
s7_29
df_st_GJ_2007 = df_2007.loc[(df_2007["State"]=="GUJARAT")]
df_st_GJ_2007
t_GJ_2007 = df_st_GJ_2007.loc[:,"Total"]
s7_30 = np.sum(t_GJ_2007)
s7_30
df_st_HR_2007 = df_2007.loc[(df_2007["State"]=="HARYANA")]
df_st_HR_2007
t_HR_2007 = df_st_HR_2007.loc[:,"Total"]
s7_31 = np.sum(t_HR_2007)
s7_31
df_st_HP_2007 = df_2007.loc[(df_2007["State"]=="HIMACHAL PRADESH")]
df_st_HP_2007
t_HP_2007 = df_st_HP_2007.loc[:,"Total"]
s7_32 = np.sum(t_HP_2007)
s7_32
df_st_JK_2007 = df_2007.loc[(df_2007["State"]=="JAMMU & KASHMIR")]
df_st_JK_2007
t_JK_2007 = df_st_JK_2007.loc[:,"Total"]
s7_33 = np.sum(t_JK_2007)
s7_33
df_st_JH_2007 = df_2007.loc[(df_2007["State"]=="JHARKHAND")]
df_st_JH_2007
t_JH_2007 = df_st_JH_2007.loc[:,"Total"]
s7_34 = np.sum(t_JH_2007)
s7_34
df_st_KN_2007 = df_2007.loc[(df_2007["State"]=="KARNATAKA")]
df_st_KN_2007
t_KN_2007 = df_st_KN_2007.loc[:,"Total"]
s7_35 = np.sum(t_KN_2007)
s7_35
df_st_KER_2007 = df_2007.loc[(df_2007["State"]=="KERALA")]
df_st_KER_2007
t_KER_2007 = df_st_KER_2007.loc[:,"Total"]
s7_36 = np.sum(t_KER_2007)
s7_36
df_st_LD_2007 = df_2007.loc[(df_2007["State"]=="LAKSHADWEEP")]
df_st_LD_2007
t_LD_2007 = df_st_LD_2007.loc[:,"Total"]
s7_37 = np.sum(t_LD_2007)
s7_37
df_st_MP_2007 = df_2007.loc[(df_2007["State"]=="MADHYA PRADESH")]
df_st_MP_2007
t_MP_2007 = df_st_MP_2007.loc[:,"Total"]
s7_38 = np.sum(t_MP_2007)
s7_38
df_st_MH_2007 = df_2007.loc[(df_2007["State"]=="MAHARASHTRA")]
df_st_MH_2007
t_MH_2007 = df_st_MH_2007.loc[:,"Total"]
s7_39 = np.sum(t_MH_2007)
s7_39
df_st_MN_2007 = df_2007.loc[(df_2007["State"]=="MANIPUR")]
df_st_MN_2007
t_MN_2007 = df_st_MN_2007.loc[:,"Total"]
s7_40 = np.sum(t_MN_2007)
s7_40
df_st_MG_2007 = df_2007.loc[(df_2007["State"]=="MEGHALAYA")]
df_st_MG_2007
t_MG_2007 = df_st_MG_2007.loc[:,"Total"]
s7_41 = np.sum(t_MG_2007)
s7_41
df_st_MZ_2007 = df_2007.loc[(df_2007["State"]=="MIZORAM")]
df_st_MZ_2007
t_MN_2007 = df_st_MN_2007.loc[:,"Total"]
s7_42 = np.sum(t_MN_2007)
s7_42
df_st_NG_2007 = df_2007.loc[(df_2007["State"]=="NAGALAND")]
df_st_NG_2007
t_NG_2007 = df_st_NG_2007.loc[:,"Total"]
s7_43 = np.sum(t_NG_2007)
s7_43
df_st_OD_2007 = df_2007.loc[(df_2007["State"]=="ODISHA")]
df_st_OD_2007
t_OD_2007 = df_st_OD_2007.loc[:,"Total"]
s7_44 = np.sum(t_OD_2007)
s7_44
df_st_PD_2007 = df_2007.loc[(df_2007["State"]=="PUDUCHERRY")]
df_st_PD_2007
t_PD_2007 = df_st_PD_2007.loc[:,"Total"]
s7_45 = np.sum(t_PD_2007)
s7_45
df_st_PB_2007 = df_2007.loc[(df_2007["State"]=="PUNJAB")]
df_st_PB_2007
t_PB_2007 = df_st_PB_2007.loc[:,"Total"]
s7_46 = np.sum(t_PB_2007)
s7_46
df_st_RJ_2007 = df_2007.loc[(df_2007["State"]=="RAJASTHAN")]
df_st_RJ_2007
t_RJ_2007 = df_st_RJ_2007.loc[:,"Total"]
s7_47 = np.sum(t_RJ_2007)
s7_47
df_st_SM_2007 = df_2007.loc[(df_2007["State"]=="SIKKIM")]
df_st_SM_2007
t_SM_2007 = df_st_SM_2007.loc[:,"Total"]
s7_48 = np.sum(t_SM_2007)
s7_48
df_st_TN_2007 = df_2007.loc[(df_2007["State"]=="TAMIL NADU")]
df_st_TN_2007
t_TN_2007 = df_st_TN_2007.loc[:,"Total"]
s7_49 = np.sum(t_TN_2007)
s7_49
df_st_TP_2007 = df_2007.loc[(df_2007["State"]=="TRIPURA")]
df_st_TP_2007
t_TP_2007 = df_st_TP_2007.loc[:,"Total"]
s7_50 = np.sum(t_TP_2007)
s7_50
df_st_UP_2007 = df_2007.loc[(df_2007["State"]=="UTTAR PRADESH")]
df_st_UP_2007
t_UP_2007 = df_st_UP_2007.loc[:,"Total"]
s7_51 = np.sum(t_UP_2007)
s7_51
df_st_UK_2007 = df_2007.loc[(df_2007["State"]=="UTTARAKHAND")]
df_st_UK_2007
t_UK_2007 = df_st_UK_2007.loc[:,"Total"]
s7_52 = np.sum(t_UK_2007)
s7_52
df_st_WB_2007 = df_2007.loc[(df_2007["State"]=="WEST BENGAL")]
df_st_WB_2007
t_WB_2007 = df_st_WB_2007.loc[:,"Total"]
s7_53 = np.sum(t_WB_2007)
s7_53
t_ANm_2007 = np.sum(df_st_AN_2007.where(df_st_AN_2007["Gender"]=="Male")["Total"])
t_ANm_2007
t_ANfm_2007 = np.sum(df_st_AN_2007.where(df_st_AN_2007["Gender"]=="Female")["Total"])
t_ANfm_2007
t_APm_2007 = np.sum(df_st_AP_2007.where(df_st_AP_2007["Gender"]=="Male")["Total"])
t_APm_2007
t_APfm_2007 = np.sum(df_st_AP_2007.where(df_st_AP_2007["Gender"]=="Female")["Total"])
t_APfm_2007
t_ARPm_2007 = np.sum(df_st_ARP_2007.where(df_st_ARP_2007["Gender"]=="Male")["Total"])
t_ARPm_2007
t_ARPfm_2007 = np.sum(df_st_ARP_2007.where(df_st_ARP_2007["Gender"]=="Female")["Total"])
t_ARPfm_2007
t_ASm_2007 = np.sum(df_st_AS_2007.where(df_st_AS_2007["Gender"]=="Male")["Total"])
t_ASm_2007
t_ASfm_2007 = np.sum(df_st_AS_2007.where(df_st_AS_2007["Gender"]=="Female")["Total"])
t_ASfm_2007
t_BHm_2007 = np.sum(df_st_BH_2007.where(df_st_BH_2007["Gender"]=="Male")["Total"])
t_BHm_2007
t_BHfm_2007 = np.sum(df_st_BH_2007.where(df_st_BH_2007["Gender"]=="Female")["Total"])
t_BHfm_2007
t_CHm_2007 = np.sum(df_st_CH_2007.where(df_st_CH_2007["Gender"]=="Male")["Total"])
t_CHm_2007
t_CHfm_2007 = np.sum(df_st_CH_2007.where(df_st_CH_2007["Gender"]=="Female")["Total"])
t_CHfm_2007
t_CTm_2007 = np.sum(df_st_CT_2007.where(df_st_CT_2007["Gender"]=="Male")["Total"])
t_CTm_2007
t_CTfm_2007 = np.sum(df_st_CT_2007.where(df_st_CT_2007["Gender"]=="Female")["Total"])
t_CTfm_2007
t_DNm_2007 = np.sum(df_st_DN_2007.where(df_st_DN_2007["Gender"]=="Male")["Total"])
t_DNm_2007
t_DNfm_2007 = np.sum(df_st_DN_2007.where(df_st_DN_2007["Gender"]=="Female")["Total"])
t_DNfm_2007
t_DDm_2007 = np.sum(df_st_DD_2007.where(df_st_DD_2007["Gender"]=="Male")["Total"])
t_DDm_2007
t_DDfm_2007 = np.sum(df_st_DD_2007.where(df_st_DD_2007["Gender"]=="Female")["Total"])
t_DDfm_2007
t_DLm_2007 = np.sum(df_st_DL_2007.where(df_st_DL_2007["Gender"]=="Male")["Total"])
t_DLm_2007
t_DLfm_2007 = np.sum(df_st_DL_2007.where(df_st_DL_2007["Gender"]=="Female")["Total"])
t_DLfm_2007
t_GOAm_2007 = np.sum(df_st_GOA_2007.where(df_st_GOA_2007["Gender"]=="Male")["Total"])
t_GOAm_2007
t_GOAfm_2007 = np.sum(df_st_GOA_2007.where(df_st_GOA_2007["Gender"]=="Female")["Total"])
t_GOAfm_2007
t_GJm_2007 = np.sum(df_st_GJ_2007.where(df_st_GJ_2007["Gender"]=="Male")["Total"])
t_GJm_2007
t_GJfm_2007 = np.sum(df_st_GJ_2007.where(df_st_GJ_2007["Gender"]=="Female")["Total"])
t_GJfm_2007
t_HRm_2007 = np.sum(df_st_HR_2007.where(df_st_HR_2007["Gender"]=="Male")["Total"])
t_HRm_2007
t_HRfm_2007 = np.sum(df_st_HR_2007.where(df_st_HR_2007["Gender"]=="Female")["Total"])
t_HRfm_2007
t_HPm_2007 = np.sum(df_st_HP_2007.where(df_st_HP_2007["Gender"]=="Male")["Total"])
t_HPm_2007
t_HPfm_2007 = np.sum(df_st_HP_2007.where(df_st_HP_2007["Gender"]=="Female")["Total"])
t_HPfm_2007
t_JKm_2007 = np.sum(df_st_JK_2007.where(df_st_JK_2007["Gender"]=="Male")["Total"])
t_JKm_2007
t_JKfm_2007 = np.sum(df_st_JK_2007.where(df_st_JK_2007["Gender"]=="Female")["Total"])
t_JKfm_2007
t_JHm_2007 = np.sum(df_st_JH_2007.where(df_st_JH_2007["Gender"]=="Male")["Total"])
t_JHm_2007
t_JHfm_2007 = np.sum(df_st_JH_2007.where(df_st_JH_2007["Gender"]=="Female")["Total"])
t_JHfm_2007
t_KNm_2007 = np.sum(df_st_KN_2007.where(df_st_KN_2007["Gender"]=="Male")["Total"])
t_KNm_2007
t_KNfm_2007 = np.sum(df_st_KN_2007.where(df_st_KN_2007["Gender"]=="Female")["Total"])
t_KNfm_2007
t_KERm_2007 = np.sum(df_st_KER_2007.where(df_st_KER_2007["Gender"]=="Male")["Total"])
t_KERm_2007
t_KERfm_2007 = np.sum(df_st_KER_2007.where(df_st_KER_2007["Gender"]=="Female")["Total"])
t_KERfm_2007
t_LDm_2007 = np.sum(df_st_LD_2007.where(df_st_LD_2007["Gender"]=="Male")["Total"])
t_LDm_2007
t_LDfm_2007 = np.sum(df_st_LD_2007.where(df_st_LD_2007["Gender"]=="Female")["Total"])
t_LDfm_2007
t_MPm_2007 = np.sum(df_st_MP_2007.where(df_st_MP_2007["Gender"]=="Male")["Total"])
t_MPm_2007
t_MPfm_2007 = np.sum(df_st_MP_2007.where(df_st_MP_2007["Gender"]=="Female")["Total"])
t_MPfm_2007
t_MHm_2007 = np.sum(df_st_MH_2007.where(df_st_MH_2007["Gender"]=="Male")["Total"])
t_MHm_2007
t_MHfm_2007 = np.sum(df_st_MH_2007.where(df_st_MH_2007["Gender"]=="Female")["Total"])
t_MHfm_2007
t_MNm_2007 = np.sum(df_st_MN_2007.where(df_st_MN_2007["Gender"]=="Male")["Total"])
t_MNm_2007
t_MNfm_2007 = np.sum(df_st_MN_2007.where(df_st_MN_2007["Gender"]=="Female")["Total"])
t_MNfm_2007
t_MGm_2007 = np.sum(df_st_MG_2007.where(df_st_MG_2007["Gender"]=="Male")["Total"])
t_MGm_2007
t_MGfm_2007 = np.sum(df_st_MG_2007.where(df_st_MG_2007["Gender"]=="Female")["Total"])
t_MGfm_2007
t_MZm_2007 = np.sum(df_st_MZ_2007.where(df_st_MZ_2007["Gender"]=="Male")["Total"])
t_MZm_2007
t_MZfm_2007 = np.sum(df_st_MZ_2007.where(df_st_MZ_2007["Gender"]=="Female")["Total"])
t_MZfm_2007
t_NGm_2007 = np.sum(df_st_NG_2007.where(df_st_NG_2007["Gender"]=="Male")["Total"])
t_NGm_2007
t_NGfm_2007 = np.sum(df_st_NG_2007.where(df_st_NG_2007["Gender"]=="Female")["Total"])
t_MGfm_2007
t_ODm_2007 = np.sum(df_st_OD_2007.where(df_st_OD_2007["Gender"]=="Male")["Total"])
t_ODm_2007
t_ODfm_2007 = np.sum(df_st_OD_2007.where(df_st_OD_2007["Gender"]=="Female")["Total"])
t_ODfm_2007
t_PDm_2007 = np.sum(df_st_PD_2007.where(df_st_PD_2007["Gender"]=="Male")["Total"])
t_PDm_2007
t_PDfm_2007 = np.sum(df_st_PD_2007.where(df_st_PD_2007["Gender"]=="Female")["Total"])
t_PDfm_2007
t_PBm_2007 = np.sum(df_st_PB_2007.where(df_st_PB_2007["Gender"]=="Male")["Total"])
t_PBm_2007
t_PBfm_2007 = np.sum(df_st_PB_2007.where(df_st_PB_2007["Gender"]=="Female")["Total"])
t_PBfm_2007
t_RJm_2007 = np.sum(df_st_RJ_2007.where(df_st_RJ_2007["Gender"]=="Male")["Total"])
t_RJm_2007
t_RJfm_2007 = np.sum(df_st_RJ_2007.where(df_st_RJ_2007["Gender"]=="Female")["Total"])
t_RJfm_2007
t_SMm_2007 = np.sum(df_st_SM_2007.where(df_st_SM_2007["Gender"]=="Male")["Total"])
t_SMm_2007
t_SMfm_2007 = np.sum(df_st_SM_2007.where(df_st_SM_2007["Gender"]=="Female")["Total"])
t_SMfm_2007
t_TNm_2007 = np.sum(df_st_TN_2007.where(df_st_TN_2007["Gender"]=="Male")["Total"])
t_TNm_2007
t_TNfm_2007 = np.sum(df_st_TN_2007.where(df_st_TN_2007["Gender"]=="Female")["Total"])
t_TNfm_2007
t_TPm_2007 = np.sum(df_st_TP_2007.where(df_st_TP_2007["Gender"]=="Male")["Total"])
t_TPm_2007
t_TPfm_2007 = np.sum(df_st_TP_2007.where(df_st_TP_2007["Gender"]=="Female")["Total"])
t_TPfm_2007
t_UPm_2007 = np.sum(df_st_UP_2007.where(df_st_UP_2007["Gender"]=="Male")["Total"])
t_UPm_2007
t_UPfm_2007 = np.sum(df_st_UP_2007.where(df_st_UP_2007["Gender"]=="Female")["Total"])
t_UPfm_2007
t_UKm_2007 = np.sum(df_st_UK_2007.where(df_st_UK_2007["Gender"]=="Male")["Total"])
t_UKm_2007
t_UKfm_2007 = np.sum(df_st_UK_2007.where(df_st_UK_2007["Gender"]=="Female")["Total"])
t_UKfm_2007
t_WBm_2007 = np.sum(df_st_WB_2007.where(df_st_WB_2007["Gender"]=="Male")["Total"])
t_WBm_2007
t_WBfm_2007 = np.sum(df_st_WB_2007.where(df_st_WB_2007["Gender"]=="Female")["Total"])
t_WBfm_2007
l_2007=list(df_2007.loc[:,"Type"].unique())
l_2007.sort()
print(l_2007,end=" ")
cause_l_2007=[]
for i in l_2007:
rough= np.sum(df_2007.where(df_2007["Type"]==i)["Total"])
cause_l_2007.append(rough)
print(cause_l_2007,end=" ")
x1_2007 = set(df_2007.loc[:,"State"])
x1_2007
len(x1_2007)
cause_df_2007 = pd.DataFrame(cause_l_2007,l_2007)
cause_df_2007.reset_index()
cause_df_2007.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2007",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2007=list(df_2007.loc[:,"State"].unique())
s_2007.sort()
print(s_2007,end=" ")
state_s_2007 = [s7_19,s7_20,s7_21,s7_22,s7_23,s7_24,s7_25,s7_26,s7_27,s7_28,s7_29,s7_30,s7_31,s7_32,s7_33,s7_34,
s7_35,s7_36,s7_37,s7_38,s7_39,s7_40,s7_41,s7_42,s7_43,s7_44,s7_45,s7_46,s7_47,s7_48,s7_49,s7_50,
s7_51,s7_52,s7_53]
print(state_s_2007,end=" ")
state_m_2007=[t_ANm_2007, t_APm_2007, t_ARPm_2007, t_ASm_2007, t_BHm_2007, t_CHm_2007, t_CTm_2007, t_DNm_2007,
t_DDm_2007, t_DLm_2007, t_GOAm_2007, t_GJm_2007, t_HRm_2007, t_HPm_2007,t_JKm_2007, t_JHm_2007,
t_KNm_2007, t_KERm_2007, t_LDm_2007,t_MPm_2007,t_MHm_2007,t_MNm_2007,t_MGm_2007,t_MZm_2007,
t_NGm_2007, t_ODm_2007, t_PDm_2007,t_PBm_2007,t_RJm_2007,t_SMm_2007,t_TNm_2007,t_TPm_2007,
t_UPm_2007, t_UKm_2007, t_WBm_2007]
print(state_m_2007,end=" ")
state_fm_2007=[t_ANfm_2007, t_APfm_2007, t_ARPfm_2007, t_ASfm_2007, t_BHfm_2007, t_CHfm_2007, t_CTfm_2007, t_DNfm_2007,
t_DDfm_2007, t_DLfm_2007, t_GOAfm_2007, t_GJfm_2007, t_HRfm_2007, t_HPfm_2007,t_JKfm_2007, t_JHfm_2007,
t_KNfm_2007, t_KERfm_2007, t_LDfm_2007,t_MPfm_2007,t_MHfm_2007,t_MNfm_2007,t_MGfm_2007,t_MZfm_2007,
t_NGfm_2007, t_ODfm_2007, t_PDfm_2007,t_PBfm_2007,t_RJfm_2007,t_SMfm_2007,t_TNfm_2007,t_TPfm_2007,
t_UPfm_2007, t_UKfm_2007, t_WBfm_2007]
print(state_fm_2007,end=" ")
df_state_2007 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s7_19,s7_20,s7_21,s7_22,s7_23,s7_24,s7_25,s7_26,s7_27,s7_28,s7_29,s7_30,s7_31,s7_32,s7_33,s7_34,
s7_35,s7_36,s7_37,s7_38,s7_39,s7_40,s7_41,s7_42,s7_43,s7_44,s7_45,s7_46,s7_47,s7_48,s7_49,s7_50,
s7_51,s7_52,s7_53],
"Male":[t_ANm_2007, t_APm_2007, t_ARPm_2007, t_ASm_2007, t_BHm_2007, t_CHm_2007, t_CTm_2007, t_DNm_2007,
t_DDm_2007, t_DLm_2007, t_GOAm_2007, t_GJm_2007, t_HRm_2007, t_HPm_2007,t_JKm_2007, t_JHm_2007,
t_KNm_2007, t_KERm_2007, t_LDm_2007,t_MPm_2007,t_MHm_2007,t_MNm_2007,t_MGm_2007,t_MZm_2007,
t_NGm_2007, t_ODm_2007, t_PDm_2007,t_PBm_2007,t_RJm_2007,t_SMm_2007,t_TNm_2007,t_TPm_2007,
t_UPm_2007, t_UKm_2007, t_WBm_2007],
"Female":[t_ANfm_2007, t_APfm_2007, t_ARPfm_2007, t_ASfm_2007, t_BHfm_2007, t_CHfm_2007, t_CTfm_2007, t_DNfm_2007,
t_DDfm_2007, t_DLfm_2007, t_GOAfm_2007, t_GJfm_2007, t_HRfm_2007, t_HPfm_2007,t_JKfm_2007, t_JHfm_2007,
t_KNfm_2007, t_KERfm_2007, t_LDfm_2007,t_MPfm_2007,t_MHfm_2007,t_MNfm_2007,t_MGfm_2007,t_MZfm_2007,
t_NGfm_2007, t_ODfm_2007, t_PDfm_2007,t_PBfm_2007,t_RJfm_2007,t_SMfm_2007,t_TNfm_2007,t_TPfm_2007,
t_UPfm_2007, t_UKfm_2007, t_WBfm_2007]
}
df_All_st_2007 = pd.DataFrame(df_state_2007)
df_All_st_2007
pivot_2007 = pd.pivot_table(df_All_st_2007, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2007
pivot_2007.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2007=[]
for i in cause_l_2007:
p=i/np.sum(cause_l_2007)
avg_2007_cause=p*100
cause_l_percent_2007.append(avg_2007_cause)
print(cause_l_percent_2007,end=" ")
np.max(cause_l_percent_2007) #Married
np.min(cause_l_percent_2007) #Ideological Causes/Hero Worshipping
state_s_2007_percent=[]
tot=np.sum(state_s_2007)
for i in state_s_2007:
xy=i/tot
avg_state_2007=xy*100
state_s_2007_percent.append(avg_state_2007)
print(state_s_2007_percent,end=" ")
np.max(state_s_2007_percent) #Maharashtra
np.min(state_s_2007_percent) #Lakshdweep
l_age_grp_2007=[s7_4,s7_5,s7_6,s7_7,s7_8,s7_54]
l_age_grp_2007
l_age_grp_2007_percent=[]
for i in l_age_grp_2007:
yz=i/s7_1
avg_2007_age_grp=yz*100
l_age_grp_2007_percent.append(avg_2007_age_grp)
l_age_grp_2007_percent
np.max(l_age_grp_2007_percent) #0-100+
np.min(l_age_grp_2007_percent) #0-14
total_male_percent_2007= (s7_2/s7_1)*100
total_male_percent_2007
total_female_percent_2007= (s7_3/s7_1)*100
total_female_percent_2007
df_2008 = suicide_df.loc[(suicide_df["Year"]==2008)]
df_2008
t2008_dcount = df_2008.loc[:,"Total"]
s8_1 = np.sum(t2008_dcount)
s8_1
male_2008 = df_2008.loc[(df_2008["Gender"]=="Male")]
male_2008
m2008_count = male_2008.loc[:,"Total"]
s8_2 = np.sum(m2008_count)
s8_2
female_2008 = df_2008.loc[(df_2008["Gender"]=="Female")]
female_2008
fm2008_count = female_2008.loc[:,"Total"]
s8_3 = np.sum(fm2008_count)
s8_3
df_age_d014_2008 = df_2008.loc[(df_2008["Age_group"]=="0-14")]
df_age_d014_2008
t_014_2008 = df_age_d014_2008.loc[:,"Total"]
s8_4 = np.sum(t_014_2008)
s8_4
df_age_d1529_2008 = df_2008.loc[(df_2008["Age_group"]=="15-29")]
df_age_d1529_2008
t_1529_2008 = df_age_d1529_2008.loc[:,"Total"]
s8_5 = np.sum(t_1529_2008)
s8_5
df_age_d3044_2008 = df_2008.loc[(df_2008["Age_group"]=="30-44")]
df_age_d3044_2008
t_3044_2008 = df_age_d3044_2008.loc[:,"Total"]
s8_6 = np.sum(t_3044_2008)
s8_6
df_age_d4559_2008 = df_2008.loc[(df_2008["Age_group"]=="45-59")]
df_age_d4559_2008
t_4559_2008 = df_age_d4559_2008.loc[:,"Total"]
s8_7 = np.sum(t_4559_2008)
s8_7
df_age_d60_2008 = df_2008.loc[(df_2008["Age_group"]=="60+")]
df_age_d60_2008
t_60_2008 = df_age_d60_2008.loc[:,"Total"]
s8_8 = np.sum(t_60_2008)
s8_8
df_age_d0100_2008 = df_2008.loc[(df_2008["Age_group"]=="0-100+")]
df_age_d0100_2008
t_0100_2008 = df_age_d0100_2008.loc[:,"Total"]
s8_54 = np.sum(t_0100_2008)
s8_54
df_014m_2008 = df_age_d014_2008.loc[(df_age_d014_2008["Gender"]=="Male")]
df_014m_2008
t_014m_2008 = df_014m_2008.loc[:,"Total"]
s8_9 = np.sum(t_014m_2008)
s8_9
df_014fm_2008 = df_age_d014_2008.loc[(df_age_d014_2008["Gender"]=="Female")]
df_014fm_2008
t_014fm_2008 = df_014fm_2008.loc[:,"Total"]
s8_10 = np.sum(t_014fm_2008)
s8_10
df_1529m_2008 = df_age_d1529_2008.loc[(df_age_d1529_2008["Gender"]=="Male")]
df_1529m_2008
t_1529m_2008 = df_1529m_2008.loc[:,"Total"]
s8_11 = np.sum(t_1529m_2008)
s8_11
df_1529fm_2008 = df_age_d1529_2008.loc[(df_age_d1529_2008["Gender"]=="Female")]
df_1529fm_2008
t_1529fm_2008 = df_1529fm_2008.loc[:,"Total"]
s8_12 = np.sum(t_1529fm_2008)
s8_12
df_3044m_2008 = df_age_d3044_2008.loc[(df_age_d3044_2008["Gender"]=="Male")]
df_3044m_2008
t_3044m_2008 = df_3044m_2008.loc[:,"Total"]
s8_13 = np.sum(t_3044m_2008)
s8_13
df_3044fm_2008 = df_age_d3044_2008.loc[(df_age_d3044_2008["Gender"]=="Female")]
df_3044fm_2008
t_3044fm_2008 = df_3044fm_2008.loc[:,"Total"]
s8_14 = np.sum(t_3044fm_2008)
s8_14
df_4559m_2008 = df_age_d4559_2008.loc[(df_age_d4559_2008["Gender"]=="Male")]
df_4559m_2008
t_4559m_2008 = df_4559m_2008.loc[:,"Total"]
s8_15 = np.sum(t_4559m_2008)
s8_15
df_4559fm_2008 = df_age_d4559_2008.loc[(df_age_d4559_2008["Gender"]=="Female")]
df_4559fm_2008
t_4559fm_2008 = df_4559fm_2008.loc[:,"Total"]
s8_16 = np.sum(t_4559fm_2008)
s8_16
df_60m_2008 = df_age_d60_2008.loc[(df_age_d60_2008["Gender"]=="Male")]
df_60m_2008
t_60m_2008 = df_60m_2008.loc[:,"Total"]
s8_17 = np.sum(t_60m_2008)
s8_17
df_60fm_2008 = df_age_d60_2008.loc[(df_age_d60_2008["Gender"]=="Female")]
df_60fm_2008
t_60fm_2008 = df_60fm_2008.loc[:,"Total"]
s8_18 = np.sum(t_60fm_2008)
s8_18
df_0100fm_2008 = df_age_d0100_2008.loc[(df_age_d0100_2008["Gender"]=="Female")]
df_0100fm_2008
t_0100fm_2008 = df_0100fm_2008.loc[:,"Total"]
s8_55 = np.sum(t_0100fm_2008)
s8_55
df_0100m_2008 = df_age_d0100_2008.loc[(df_age_d0100_2008["Gender"]=="Male")]
df_0100m_2008
t_0100m_2008 = df_0100m_2008.loc[:,"Total"]
s8_56 = np.sum(t_0100m_2008)
s8_56
df_st_AN_2008 = df_2008.loc[(df_2008["State"]=="A & N ISLANDS")]
df_st_AN_2008
t_AN_2008 = df_st_AN_2008.loc[:,"Total"]
s8_19 = np.sum(t_AN_2008)
s8_19
df_st_AP_2008 = df_2008.loc[(df_2008["State"]=="ANDHRA PRADESH")]
df_st_AP_2008
t_AP_2008 = df_st_AP_2008.loc[:,"Total"]
s8_20 = np.sum(t_AP_2008)
s8_20
df_st_ARP_2008 = df_2008.loc[(df_2008["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2008
t_ARP_2008 = df_st_ARP_2008.loc[:,"Total"]
s8_21 = np.sum(t_ARP_2008)
s8_21
df_st_AS_2008 = df_2008.loc[(df_2008["State"]=="ASSAM")]
df_st_AS_2008
t_AS_2008 = df_st_AS_2008.loc[:,"Total"]
s8_22 = np.sum(t_AS_2008)
s8_22
df_st_BH_2008 = df_2008.loc[(df_2008["State"]=="BIHAR")]
df_st_BH_2008
t_BH_2008 = df_st_BH_2008.loc[:,"Total"]
s8_23 = np.sum(t_BH_2008)
s8_23
df_st_CH_2008 = df_2008.loc[(df_2008["State"]=="CHANDIGARH")]
df_st_CH_2008
t_CH_2008 = df_st_CH_2008.loc[:,"Total"]
s8_24 = np.sum(t_CH_2008)
s8_24
df_st_CT_2008 = df_2008.loc[(df_2008["State"]=="CHHATTISGARH")]
df_st_CT_2008
t_CT_2008 = df_st_CT_2008.loc[:,"Total"]
s8_25 = np.sum(t_CT_2008)
s8_25
df_st_DN_2008 = df_2008.loc[(df_2008["State"]=="D & N HAVELI")]
df_st_DN_2008
t_DN_2008 = df_st_DN_2008.loc[:,"Total"]
s8_26 = np.sum(t_DN_2008)
s8_26
df_st_DD_2008 = df_2008.loc[(df_2008["State"]=="DAMAN & DIU")]
df_st_DD_2008
t_DD_2008 = df_st_DD_2008.loc[:,"Total"]
s8_27 = np.sum(t_DD_2008)
s8_27
df_st_DL_2008 = df_2008.loc[(df_2008["State"]=="DELHI (UT)")]
df_st_DL_2008
t_DL_2008 = df_st_DL_2008.loc[:,"Total"]
s8_28 = np.sum(t_DL_2008)
s8_28
df_st_GOA_2008 = df_2008.loc[(df_2008["State"]=="GOA")]
df_st_GOA_2008
t_GOA_2008 = df_st_GOA_2008.loc[:,"Total"]
s8_29 = np.sum(t_GOA_2008)
s8_29
df_st_GJ_2008 = df_2008.loc[(df_2008["State"]=="GUJARAT")]
df_st_GJ_2008
t_GJ_2008 = df_st_GJ_2008.loc[:,"Total"]
s8_30 = np.sum(t_GJ_2008)
s8_30
df_st_HR_2008 = df_2008.loc[(df_2008["State"]=="HARYANA")]
df_st_HR_2008
t_HR_2008 = df_st_HR_2008.loc[:,"Total"]
s8_31 = np.sum(t_HR_2008)
s8_31
df_st_HP_2008 = df_2008.loc[(df_2008["State"]=="HIMACHAL PRADESH")]
df_st_HP_2008
t_HP_2008 = df_st_HP_2008.loc[:,"Total"]
s8_32 = np.sum(t_HP_2008)
s8_32
df_st_JK_2008 = df_2008.loc[(df_2008["State"]=="JAMMU & KASHMIR")]
df_st_JK_2008
t_JK_2008 = df_st_JK_2008.loc[:,"Total"]
s8_33 = np.sum(t_JK_2008)
s8_33
df_st_JH_2008 = df_2008.loc[(df_2008["State"]=="JHARKHAND")]
df_st_JH_2008
t_JH_2008 = df_st_JH_2008.loc[:,"Total"]
s8_34 = np.sum(t_JH_2008)
s8_34
df_st_KN_2008 = df_2008.loc[(df_2008["State"]=="KARNATAKA")]
df_st_KN_2008
t_KN_2008 = df_st_KN_2008.loc[:,"Total"]
s8_35 = np.sum(t_KN_2008)
s8_35
df_st_KER_2008 = df_2008.loc[(df_2008["State"]=="KERALA")]
df_st_KER_2008
t_KER_2008 = df_st_KER_2008.loc[:,"Total"]
s8_36 = np.sum(t_KER_2008)
s8_36
df_st_LD_2008 = df_2008.loc[(df_2008["State"]=="LAKSHADWEEP")]
df_st_LD_2008
t_LD_2008 = df_st_LD_2008.loc[:,"Total"]
s8_37 = np.sum(t_LD_2008)
s8_37
df_st_MP_2008 = df_2008.loc[(df_2008["State"]=="MADHYA PRADESH")]
df_st_MP_2008
t_MP_2008 = df_st_MP_2008.loc[:,"Total"]
s8_38 = np.sum(t_MP_2008)
s8_38
df_st_MH_2008 = df_2008.loc[(df_2008["State"]=="MAHARASHTRA")]
df_st_MH_2008
t_MH_2008 = df_st_MH_2008.loc[:,"Total"]
s8_39 = np.sum(t_MH_2008)
s8_39
df_st_MN_2008 = df_2008.loc[(df_2008["State"]=="MANIPUR")]
df_st_MN_2008
t_MN_2008 = df_st_MN_2008.loc[:,"Total"]
s8_40 = np.sum(t_MN_2008)
s8_40
df_st_MG_2008 = df_2008.loc[(df_2008["State"]=="MEGHALAYA")]
df_st_MG_2008
t_MG_2008 = df_st_MG_2008.loc[:,"Total"]
s8_41 = np.sum(t_MG_2008)
s8_41
df_st_MZ_2008 = df_2008.loc[(df_2008["State"]=="MIZORAM")]
df_st_MZ_2008
t_MN_2008 = df_st_MN_2008.loc[:,"Total"]
s8_42 = np.sum(t_MN_2008)
s8_42
df_st_NG_2008 = df_2008.loc[(df_2008["State"]=="NAGALAND")]
df_st_NG_2008
t_NG_2008 = df_st_NG_2008.loc[:,"Total"]
s8_43 = np.sum(t_NG_2008)
s8_43
df_st_OD_2008 = df_2008.loc[(df_2008["State"]=="ODISHA")]
df_st_OD_2008
t_OD_2008 = df_st_OD_2008.loc[:,"Total"]
s8_44 = np.sum(t_OD_2008)
s8_44
df_st_PD_2008 = df_2008.loc[(df_2008["State"]=="PUDUCHERRY")]
df_st_PD_2008
t_PD_2008 = df_st_PD_2008.loc[:,"Total"]
s8_45 = np.sum(t_PD_2008)
s8_45
df_st_PB_2008 = df_2008.loc[(df_2008["State"]=="PUNJAB")]
df_st_PB_2008
t_PB_2008 = df_st_PB_2008.loc[:,"Total"]
s8_46 = np.sum(t_PB_2008)
s8_46
df_st_RJ_2008 = df_2008.loc[(df_2008["State"]=="RAJASTHAN")]
df_st_RJ_2008
t_RJ_2008 = df_st_RJ_2008.loc[:,"Total"]
s8_47 = np.sum(t_RJ_2008)
s8_47
df_st_SM_2008 = df_2008.loc[(df_2008["State"]=="SIKKIM")]
df_st_SM_2008
t_SM_2008 = df_st_SM_2008.loc[:,"Total"]
s8_48 = np.sum(t_SM_2008)
s8_48
df_st_TN_2008 = df_2008.loc[(df_2008["State"]=="TAMIL NADU")]
df_st_TN_2008
t_TN_2008 = df_st_TN_2008.loc[:,"Total"]
s8_49 = np.sum(t_TN_2008)
s8_49
df_st_TP_2008 = df_2008.loc[(df_2008["State"]=="TRIPURA")]
df_st_TP_2008
t_TP_2008 = df_st_TP_2008.loc[:,"Total"]
s8_50 = np.sum(t_TP_2008)
s8_50
df_st_UP_2008 = df_2008.loc[(df_2008["State"]=="UTTAR PRADESH")]
df_st_UP_2008
t_UP_2008 = df_st_UP_2008.loc[:,"Total"]
s8_51 = np.sum(t_UP_2008)
s8_51
df_st_UK_2008 = df_2008.loc[(df_2008["State"]=="UTTARAKHAND")]
df_st_UK_2008
t_UK_2008 = df_st_UK_2008.loc[:,"Total"]
s8_52 = np.sum(t_UK_2008)
s8_52
df_st_WB_2008 = df_2008.loc[(df_2008["State"]=="WEST BENGAL")]
df_st_WB_2008
t_WB_2008 = df_st_WB_2008.loc[:,"Total"]
s8_53 = np.sum(t_WB_2008)
s8_53
t_ANm_2008 = np.sum(df_st_AN_2008.where(df_st_AN_2008["Gender"]=="Male")["Total"])
t_ANm_2008
t_ANfm_2008 = np.sum(df_st_AN_2008.where(df_st_AN_2008["Gender"]=="Female")["Total"])
t_ANfm_2008
t_APm_2008 = np.sum(df_st_AP_2008.where(df_st_AP_2008["Gender"]=="Male")["Total"])
t_APm_2008
t_APfm_2008 = np.sum(df_st_AP_2008.where(df_st_AP_2008["Gender"]=="Female")["Total"])
t_APfm_2008
t_ARPm_2008 = np.sum(df_st_ARP_2008.where(df_st_ARP_2008["Gender"]=="Male")["Total"])
t_ARPm_2008
t_ARPfm_2008 = np.sum(df_st_ARP_2008.where(df_st_ARP_2008["Gender"]=="Female")["Total"])
t_ARPfm_2008
t_ASm_2008 = np.sum(df_st_AS_2008.where(df_st_AS_2008["Gender"]=="Male")["Total"])
t_ASm_2008
t_ASfm_2008 = np.sum(df_st_AS_2008.where(df_st_AS_2008["Gender"]=="Female")["Total"])
t_ASfm_2008
t_BHm_2008 = np.sum(df_st_BH_2008.where(df_st_BH_2008["Gender"]=="Male")["Total"])
t_BHm_2008
t_BHfm_2008 = np.sum(df_st_BH_2008.where(df_st_BH_2008["Gender"]=="Female")["Total"])
t_BHfm_2008
t_CHm_2008 = np.sum(df_st_CH_2008.where(df_st_CH_2008["Gender"]=="Male")["Total"])
t_CHm_2008
t_CHfm_2008 = np.sum(df_st_CH_2008.where(df_st_CH_2008["Gender"]=="Female")["Total"])
t_CHfm_2008
t_CTm_2008 = np.sum(df_st_CT_2008.where(df_st_CT_2008["Gender"]=="Male")["Total"])
t_CTm_2008
t_CTfm_2008 = np.sum(df_st_CT_2008.where(df_st_CT_2008["Gender"]=="Female")["Total"])
t_CTfm_2008
t_DNm_2008 = np.sum(df_st_DN_2008.where(df_st_DN_2008["Gender"]=="Male")["Total"])
t_DNm_2008
t_DNfm_2008 = np.sum(df_st_DN_2008.where(df_st_DN_2008["Gender"]=="Female")["Total"])
t_DNfm_2008
t_DDm_2008 = np.sum(df_st_DD_2008.where(df_st_DD_2008["Gender"]=="Male")["Total"])
t_DDm_2008
t_DDfm_2008 = np.sum(df_st_DD_2008.where(df_st_DD_2008["Gender"]=="Female")["Total"])
t_DDfm_2008
t_DLm_2008 = np.sum(df_st_DL_2008.where(df_st_DL_2008["Gender"]=="Male")["Total"])
t_DLm_2008
t_DLfm_2008 = np.sum(df_st_DL_2008.where(df_st_DL_2008["Gender"]=="Female")["Total"])
t_DLfm_2008
t_GOAm_2008 = np.sum(df_st_GOA_2008.where(df_st_GOA_2008["Gender"]=="Male")["Total"])
t_GOAm_2008
t_GOAfm_2008 = np.sum(df_st_GOA_2008.where(df_st_GOA_2008["Gender"]=="Female")["Total"])
t_GOAfm_2008
t_GJm_2008 = np.sum(df_st_GJ_2008.where(df_st_GJ_2008["Gender"]=="Male")["Total"])
t_GJm_2008
t_GJfm_2008 = np.sum(df_st_GJ_2008.where(df_st_GJ_2008["Gender"]=="Female")["Total"])
t_GJfm_2008
t_HRm_2008 = np.sum(df_st_HR_2008.where(df_st_HR_2008["Gender"]=="Male")["Total"])
t_HRm_2008
t_HRfm_2008 = np.sum(df_st_HR_2008.where(df_st_HR_2008["Gender"]=="Female")["Total"])
t_HRfm_2008
t_HPm_2008 = np.sum(df_st_HP_2008.where(df_st_HP_2008["Gender"]=="Male")["Total"])
t_HPm_2008
t_HPfm_2008 = np.sum(df_st_HP_2008.where(df_st_HP_2008["Gender"]=="Female")["Total"])
t_HPfm_2008
t_JKm_2008 = np.sum(df_st_JK_2008.where(df_st_JK_2008["Gender"]=="Male")["Total"])
t_JKm_2008
t_JKfm_2008 = np.sum(df_st_JK_2008.where(df_st_JK_2008["Gender"]=="Female")["Total"])
t_JKfm_2008
t_JHm_2008 = np.sum(df_st_JH_2008.where(df_st_JH_2008["Gender"]=="Male")["Total"])
t_JHm_2008
t_JHfm_2008 = np.sum(df_st_JH_2008.where(df_st_JH_2008["Gender"]=="Female")["Total"])
t_JHfm_2008
t_KNm_2008 = np.sum(df_st_KN_2008.where(df_st_KN_2008["Gender"]=="Male")["Total"])
t_KNm_2008
t_KNfm_2008 = np.sum(df_st_KN_2008.where(df_st_KN_2008["Gender"]=="Female")["Total"])
t_KNfm_2008
t_KERm_2008 = np.sum(df_st_KER_2008.where(df_st_KER_2008["Gender"]=="Male")["Total"])
t_KERm_2008
t_KERfm_2008 = np.sum(df_st_KER_2008.where(df_st_KER_2008["Gender"]=="Female")["Total"])
t_KERfm_2008
t_LDm_2008 = np.sum(df_st_LD_2008.where(df_st_LD_2008["Gender"]=="Male")["Total"])
t_LDm_2008
t_LDfm_2008 = np.sum(df_st_LD_2008.where(df_st_LD_2008["Gender"]=="Female")["Total"])
t_LDfm_2008
t_MPm_2008 = np.sum(df_st_MP_2008.where(df_st_MP_2008["Gender"]=="Male")["Total"])
t_MPm_2008
t_MPfm_2008 = np.sum(df_st_MP_2008.where(df_st_MP_2008["Gender"]=="Female")["Total"])
t_MPfm_2008
t_MHm_2008 = np.sum(df_st_MH_2008.where(df_st_MH_2008["Gender"]=="Male")["Total"])
t_MHm_2008
t_MHfm_2008 = np.sum(df_st_MH_2008.where(df_st_MH_2008["Gender"]=="Female")["Total"])
t_MHfm_2008
t_MNm_2008 = np.sum(df_st_MN_2008.where(df_st_MN_2008["Gender"]=="Male")["Total"])
t_MNm_2008
t_MNfm_2008 = np.sum(df_st_MN_2008.where(df_st_MN_2008["Gender"]=="Female")["Total"])
t_MNfm_2008
t_MGm_2008 = np.sum(df_st_MG_2008.where(df_st_MG_2008["Gender"]=="Male")["Total"])
t_MGm_2008
t_MGfm_2008 = np.sum(df_st_MG_2008.where(df_st_MG_2008["Gender"]=="Female")["Total"])
t_MGfm_2008
t_MZm_2008 = np.sum(df_st_MZ_2008.where(df_st_MZ_2008["Gender"]=="Male")["Total"])
t_MZm_2008
t_MZfm_2008 = np.sum(df_st_MZ_2008.where(df_st_MZ_2008["Gender"]=="Female")["Total"])
t_MZfm_2008
t_NGm_2008 = np.sum(df_st_NG_2008.where(df_st_NG_2008["Gender"]=="Male")["Total"])
t_NGm_2008
t_NGfm_2008 = np.sum(df_st_NG_2008.where(df_st_NG_2008["Gender"]=="Female")["Total"])
t_MGfm_2008
t_ODm_2008 = np.sum(df_st_OD_2008.where(df_st_OD_2008["Gender"]=="Male")["Total"])
t_ODm_2008
t_ODfm_2008 = np.sum(df_st_OD_2008.where(df_st_OD_2008["Gender"]=="Female")["Total"])
t_ODfm_2008
t_PDm_2008 = np.sum(df_st_PD_2008.where(df_st_PD_2008["Gender"]=="Male")["Total"])
t_PDm_2008
t_PDfm_2008 = np.sum(df_st_PD_2008.where(df_st_PD_2008["Gender"]=="Female")["Total"])
t_PDfm_2008
t_PBm_2008 = np.sum(df_st_PB_2008.where(df_st_PB_2008["Gender"]=="Male")["Total"])
t_PBm_2008
t_PBfm_2008 = np.sum(df_st_PB_2008.where(df_st_PB_2008["Gender"]=="Female")["Total"])
t_PBfm_2008
t_RJm_2008 = np.sum(df_st_RJ_2008.where(df_st_RJ_2008["Gender"]=="Male")["Total"])
t_RJm_2008
t_RJfm_2008 = np.sum(df_st_RJ_2008.where(df_st_RJ_2008["Gender"]=="Female")["Total"])
t_RJfm_2008
t_SMm_2008 = np.sum(df_st_SM_2008.where(df_st_SM_2008["Gender"]=="Male")["Total"])
t_SMm_2008
t_SMfm_2008 = np.sum(df_st_SM_2008.where(df_st_SM_2008["Gender"]=="Female")["Total"])
t_SMfm_2008
t_TNm_2008 = np.sum(df_st_TN_2008.where(df_st_TN_2008["Gender"]=="Male")["Total"])
t_TNm_2008
t_TNfm_2008 = np.sum(df_st_TN_2008.where(df_st_TN_2008["Gender"]=="Female")["Total"])
t_TNfm_2008
t_TPm_2008 = np.sum(df_st_TP_2008.where(df_st_TP_2008["Gender"]=="Male")["Total"])
t_TPm_2008
t_TPfm_2008 = np.sum(df_st_TP_2008.where(df_st_TP_2008["Gender"]=="Female")["Total"])
t_TPfm_2008
t_UPm_2008 = np.sum(df_st_UP_2008.where(df_st_UP_2008["Gender"]=="Male")["Total"])
t_UPm_2008
t_UPfm_2008 = np.sum(df_st_UP_2008.where(df_st_UP_2008["Gender"]=="Female")["Total"])
t_UPfm_2008
t_UKm_2008 = np.sum(df_st_UK_2008.where(df_st_UK_2008["Gender"]=="Male")["Total"])
t_UKm_2008
t_UKfm_2008 = np.sum(df_st_UK_2008.where(df_st_UK_2008["Gender"]=="Female")["Total"])
t_UKfm_2008
t_WBm_2008 = np.sum(df_st_WB_2008.where(df_st_WB_2008["Gender"]=="Male")["Total"])
t_WBm_2008
t_WBfm_2008 = np.sum(df_st_WB_2008.where(df_st_WB_2008["Gender"]=="Female")["Total"])
t_WBfm_2008
l_2008=list(df_2008.loc[:,"Type"].unique())
l_2008.sort()
print(l_2008,end=" ")
cause_l_2008=[]
for i in l_2008:
rough= np.sum(df_2008.where(df_2008["Type"]==i)["Total"])
cause_l_2008.append(rough)
print(cause_l_2008,end=" ")
x1_2008 = set(df_2008.loc[:,"State"])
x1_2008
len(x1_2008)
cause_df_2008 = pd.DataFrame(cause_l_2008,l_2008)
cause_df_2008.reset_index()
cause_df_2008.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2008",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2008=list(df_2008.loc[:,"State"].unique())
s_2008.sort()
print(s_2008,end=" ")
state_s_2008 = [s8_19,s8_20,s8_21,s8_22,s8_23,s8_24,s8_25,s8_26,s8_27,s8_28,s8_29,s8_30,s8_31,s8_32,s8_33,s8_34,
s8_35,s8_36,s8_37,s8_38,s8_39,s8_40,s8_41,s8_42,s8_43,s8_44,s8_45,s8_46,s8_47,s8_48,s8_49,s8_50,
s8_51,s8_52,s8_53]
print(state_s_2008,end=" ")
state_m_2008=[t_ANm_2008, t_APm_2008, t_ARPm_2008, t_ASm_2008, t_BHm_2008, t_CHm_2008, t_CTm_2008, t_DNm_2008,
t_DDm_2008, t_DLm_2008, t_GOAm_2008, t_GJm_2008, t_HRm_2008, t_HPm_2008,t_JKm_2008, t_JHm_2008,
t_KNm_2008, t_KERm_2008, t_LDm_2008,t_MPm_2008,t_MHm_2008,t_MNm_2008,t_MGm_2008,t_MZm_2008,
t_NGm_2008, t_ODm_2008, t_PDm_2008,t_PBm_2008,t_RJm_2008,t_SMm_2008,t_TNm_2008,t_TPm_2008,
t_UPm_2008, t_UKm_2008, t_WBm_2008]
print(state_m_2008,end=" ")
state_fm_2008=[t_ANfm_2008, t_APfm_2008, t_ARPfm_2008, t_ASfm_2008, t_BHfm_2008, t_CHfm_2008, t_CTfm_2008, t_DNfm_2008,
t_DDfm_2008, t_DLfm_2008, t_GOAfm_2008, t_GJfm_2008, t_HRfm_2008, t_HPfm_2008,t_JKfm_2008, t_JHfm_2008,
t_KNfm_2008, t_KERfm_2008, t_LDfm_2008,t_MPfm_2008,t_MHfm_2008,t_MNfm_2008,t_MGfm_2008,t_MZfm_2008,
t_NGfm_2008, t_ODfm_2008, t_PDfm_2008,t_PBfm_2008,t_RJfm_2008,t_SMfm_2008,t_TNfm_2008,t_TPfm_2008,
t_UPfm_2008, t_UKfm_2008, t_WBfm_2008]
print(state_fm_2008,end=" ")
df_state_2008 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s8_19,s8_20,s8_21,s8_22,s8_23,s8_24,s8_25,s8_26,s8_27,s8_28,s8_29,s8_30,s8_31,s8_32,s8_33,s8_34,
s8_35,s8_36,s8_37,s8_38,s8_39,s8_40,s8_41,s8_42,s8_43,s8_44,s8_45,s8_46,s8_47,s8_48,s8_49,s8_50,
s8_51,s8_52,s8_53],
"Male":[t_ANm_2008, t_APm_2008, t_ARPm_2008, t_ASm_2008, t_BHm_2008, t_CHm_2008, t_CTm_2008, t_DNm_2008,
t_DDm_2008, t_DLm_2008, t_GOAm_2008, t_GJm_2008, t_HRm_2008, t_HPm_2008,t_JKm_2008, t_JHm_2008,
t_KNm_2008, t_KERm_2008, t_LDm_2008,t_MPm_2008,t_MHm_2008,t_MNm_2008,t_MGm_2008,t_MZm_2008,
t_NGm_2008, t_ODm_2008, t_PDm_2008,t_PBm_2008,t_RJm_2008,t_SMm_2008,t_TNm_2008,t_TPm_2008,
t_UPm_2008, t_UKm_2008, t_WBm_2008],
"Female":[t_ANfm_2008, t_APfm_2008, t_ARPfm_2008, t_ASfm_2008, t_BHfm_2008, t_CHfm_2008, t_CTfm_2008, t_DNfm_2008,
t_DDfm_2008, t_DLfm_2008, t_GOAfm_2008, t_GJfm_2008, t_HRfm_2008, t_HPfm_2008,t_JKfm_2008, t_JHfm_2008,
t_KNfm_2008, t_KERfm_2008, t_LDfm_2008,t_MPfm_2008,t_MHfm_2008,t_MNfm_2008,t_MGfm_2008,t_MZfm_2008,
t_NGfm_2008, t_ODfm_2008, t_PDfm_2008,t_PBfm_2008,t_RJfm_2008,t_SMfm_2008,t_TNfm_2008,t_TPfm_2008,
t_UPfm_2008, t_UKfm_2008, t_WBfm_2008]
}
df_All_st_2008 = pd.DataFrame(df_state_2008)
df_All_st_2008
pivot_2008 = pd.pivot_table(df_All_st_2008, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2008
pivot_2008.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2008=[]
for i in cause_l_2008:
p=i/np.sum(cause_l_2008)
avg_2008_cause=p*100
cause_l_percent_2008.append(avg_2008_cause)
print(cause_l_percent_2008,end=" ")
np.max(cause_l_percent_2008) #Married
np.min(cause_l_percent_2008) #Ideological Causes/Hero Worshipping
state_s_2008_percent=[]
tot=np.sum(state_s_2008)
for i in state_s_2008:
xy=i/tot
avg_state_2008=xy*100
state_s_2008_percent.append(avg_state_2008)
print(state_s_2008_percent,end=" ")
np.max(state_s_2008_percent) #Maharashtra
np.min(state_s_2008_percent) #Lakshdweep
l_age_grp_2008=[s8_4,s8_5,s8_6,s8_7,s8_8,s8_54]
l_age_grp_2008
l_age_grp_2008_percent=[]
for i in l_age_grp_2008:
yz=i/s8_1
avg_2008_age_grp=yz*100
l_age_grp_2008_percent.append(avg_2008_age_grp)
l_age_grp_2008_percent
np.max(l_age_grp_2008_percent) #0-100+
np.min(l_age_grp_2008_percent) #0-14
total_male_percent_2008= (s8_2/s8_1)*100
total_male_percent_2008
total_female_percent_2008= (s8_3/s8_1)*100
total_female_percent_2008
df_2009 = suicide_df.loc[(suicide_df["Year"]==2009)]
df_2009
t2009_dcount = df_2009.loc[:,"Total"]
s9_1 = np.sum(t2009_dcount)
s9_1
male_2009 = df_2009.loc[(df_2009["Gender"]=="Male")]
male_2009
m2009_count = male_2009.loc[:,"Total"]
s9_2 = np.sum(m2009_count)
s9_2
female_2009 = df_2009.loc[(df_2009["Gender"]=="Female")]
female_2009
fm2009_count = female_2009.loc[:,"Total"]
s9_3 = np.sum(fm2009_count)
s9_3
df_age_d014_2009 = df_2009.loc[(df_2009["Age_group"]=="0-14")]
df_age_d014_2009
t_014_2009 = df_age_d014_2009.loc[:,"Total"]
s9_4 = np.sum(t_014_2009)
s9_4
df_age_d1529_2009 = df_2009.loc[(df_2009["Age_group"]=="15-29")]
df_age_d1529_2009
t_1529_2009 = df_age_d1529_2009.loc[:,"Total"]
s9_5 = np.sum(t_1529_2009)
s9_5
df_age_d3044_2009 = df_2009.loc[(df_2009["Age_group"]=="30-44")]
df_age_d3044_2009
t_3044_2009 = df_age_d3044_2009.loc[:,"Total"]
s9_6 = np.sum(t_3044_2009)
s9_6
df_age_d4559_2009 = df_2009.loc[(df_2009["Age_group"]=="45-59")]
df_age_d4559_2009
t_4559_2009 = df_age_d4559_2009.loc[:,"Total"]
s9_7 = np.sum(t_4559_2009)
s9_7
df_age_d60_2009 = df_2009.loc[(df_2009["Age_group"]=="60+")]
df_age_d60_2009
t_60_2009 = df_age_d60_2009.loc[:,"Total"]
s9_8 = np.sum(t_60_2009)
s9_8
df_age_d0100_2009 = df_2009.loc[(df_2009["Age_group"]=="0-100+")]
df_age_d0100_2009
t_0100_2009 = df_age_d0100_2009.loc[:,"Total"]
s9_54 = np.sum(t_0100_2009)
s9_54
df_014m_2009 = df_age_d014_2009.loc[(df_age_d014_2009["Gender"]=="Male")]
df_014m_2009
t_014m_2009 = df_014m_2009.loc[:,"Total"]
s9_9 = np.sum(t_014m_2009)
s9_9
df_014fm_2009 = df_age_d014_2009.loc[(df_age_d014_2009["Gender"]=="Female")]
df_014fm_2009
t_014fm_2009 = df_014fm_2009.loc[:,"Total"]
s9_10 = np.sum(t_014fm_2009)
s9_10
df_1529m_2009 = df_age_d1529_2009.loc[(df_age_d1529_2009["Gender"]=="Male")]
df_1529m_2009
t_1529m_2009 = df_1529m_2009.loc[:,"Total"]
s9_11 = np.sum(t_1529m_2009)
s9_11
df_1529fm_2009 = df_age_d1529_2009.loc[(df_age_d1529_2009["Gender"]=="Female")]
df_1529fm_2009
t_1529fm_2009 = df_1529fm_2009.loc[:,"Total"]
s9_12 = np.sum(t_1529fm_2009)
s9_12
df_3044m_2009 = df_age_d3044_2009.loc[(df_age_d3044_2009["Gender"]=="Male")]
df_3044m_2009
t_3044m_2009 = df_3044m_2009.loc[:,"Total"]
s9_13 = np.sum(t_3044m_2009)
s9_13
df_3044fm_2009 = df_age_d3044_2009.loc[(df_age_d3044_2009["Gender"]=="Female")]
df_3044fm_2009
t_3044fm_2009 = df_3044fm_2009.loc[:,"Total"]
s9_14 = np.sum(t_3044fm_2009)
s9_14
df_4559m_2009 = df_age_d4559_2009.loc[(df_age_d4559_2009["Gender"]=="Male")]
df_4559m_2009
t_4559m_2009 = df_4559m_2009.loc[:,"Total"]
s9_15 = np.sum(t_4559m_2009)
s9_15
df_4559fm_2009 = df_age_d4559_2009.loc[(df_age_d4559_2009["Gender"]=="Female")]
df_4559fm_2009
t_4559fm_2009 = df_4559fm_2009.loc[:,"Total"]
s9_16 = np.sum(t_4559fm_2009)
s9_16
df_60m_2009 = df_age_d60_2009.loc[(df_age_d60_2009["Gender"]=="Male")]
df_60m_2009
t_60m_2009 = df_60m_2009.loc[:,"Total"]
s9_17 = np.sum(t_60m_2009)
s9_17
df_60fm_2009 = df_age_d60_2009.loc[(df_age_d60_2009["Gender"]=="Female")]
df_60fm_2009
t_60fm_2009 = df_60fm_2009.loc[:,"Total"]
s9_18 = np.sum(t_60fm_2009)
s9_18
df_0100fm_2009 = df_age_d0100_2009.loc[(df_age_d0100_2009["Gender"]=="Female")]
df_0100fm_2009
t_0100fm_2009 = df_0100fm_2009.loc[:,"Total"]
s9_55 = np.sum(t_0100fm_2009)
s9_55
df_0100m_2009 = df_age_d0100_2009.loc[(df_age_d0100_2009["Gender"]=="Male")]
df_0100m_2009
t_0100m_2009 = df_0100m_2009.loc[:,"Total"]
s9_56 = np.sum(t_0100m_2009)
s9_56
df_st_AN_2009 = df_2009.loc[(df_2009["State"]=="A & N ISLANDS")]
df_st_AN_2009
t_AN_2009 = df_st_AN_2009.loc[:,"Total"]
s9_19 = np.sum(t_AN_2009)
s9_19
df_st_AP_2009 = df_2009.loc[(df_2009["State"]=="ANDHRA PRADESH")]
df_st_AP_2009
t_AP_2009 = df_st_AP_2009.loc[:,"Total"]
s9_20 = np.sum(t_AP_2009)
s9_20
df_st_ARP_2009 = df_2009.loc[(df_2009["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2009
t_ARP_2009 = df_st_ARP_2009.loc[:,"Total"]
s9_21 = np.sum(t_ARP_2009)
s9_21
df_st_AS_2009 = df_2009.loc[(df_2009["State"]=="ASSAM")]
df_st_AS_2009
t_AS_2009 = df_st_AS_2009.loc[:,"Total"]
s9_22 = np.sum(t_AS_2009)
s9_22
df_st_BH_2009 = df_2009.loc[(df_2009["State"]=="BIHAR")]
df_st_BH_2009
t_BH_2009 = df_st_BH_2009.loc[:,"Total"]
s9_23 = np.sum(t_BH_2009)
s9_23
df_st_CH_2009 = df_2009.loc[(df_2009["State"]=="CHANDIGARH")]
df_st_CH_2009
t_CH_2009 = df_st_CH_2009.loc[:,"Total"]
s9_24 = np.sum(t_CH_2009)
s9_24
df_st_CT_2009 = df_2009.loc[(df_2009["State"]=="CHHATTISGARH")]
df_st_CT_2009
t_CT_2009 = df_st_CT_2009.loc[:,"Total"]
s9_25 = np.sum(t_CT_2009)
s9_25
df_st_DN_2009 = df_2009.loc[(df_2009["State"]=="D & N HAVELI")]
df_st_DN_2009
t_DN_2009 = df_st_DN_2009.loc[:,"Total"]
s9_26 = np.sum(t_DN_2009)
s9_26
df_st_DD_2009 = df_2009.loc[(df_2009["State"]=="DAMAN & DIU")]
df_st_DD_2009
t_DD_2009 = df_st_DD_2009.loc[:,"Total"]
s9_27 = np.sum(t_DD_2009)
s9_27
df_st_DL_2009 = df_2009.loc[(df_2009["State"]=="DELHI (UT)")]
df_st_DL_2009
t_DL_2009 = df_st_DL_2009.loc[:,"Total"]
s9_28 = np.sum(t_DL_2009)
s9_28
df_st_GOA_2009 = df_2009.loc[(df_2009["State"]=="GOA")]
df_st_GOA_2009
t_GOA_2009 = df_st_GOA_2009.loc[:,"Total"]
s9_29 = np.sum(t_GOA_2009)
s9_29
df_st_GJ_2009 = df_2009.loc[(df_2009["State"]=="GUJARAT")]
df_st_GJ_2009
t_GJ_2009 = df_st_GJ_2009.loc[:,"Total"]
s9_30 = np.sum(t_GJ_2009)
s9_30
df_st_HR_2009 = df_2009.loc[(df_2009["State"]=="HARYANA")]
df_st_HR_2009
t_HR_2009 = df_st_HR_2009.loc[:,"Total"]
s9_31 = np.sum(t_HR_2009)
s9_31
df_st_HP_2009 = df_2009.loc[(df_2009["State"]=="HIMACHAL PRADESH")]
df_st_HP_2009
t_HP_2009 = df_st_HP_2009.loc[:,"Total"]
s9_32 = np.sum(t_HP_2009)
s9_32
df_st_JK_2009 = df_2009.loc[(df_2009["State"]=="JAMMU & KASHMIR")]
df_st_JK_2009
t_JK_2009 = df_st_JK_2009.loc[:,"Total"]
s9_33 = np.sum(t_JK_2009)
s9_33
df_st_JH_2009 = df_2009.loc[(df_2009["State"]=="JHARKHAND")]
df_st_JH_2009
t_JH_2009 = df_st_JH_2009.loc[:,"Total"]
s9_34 = np.sum(t_JH_2009)
s9_34
df_st_KN_2009 = df_2009.loc[(df_2009["State"]=="KARNATAKA")]
df_st_KN_2009
t_KN_2009 = df_st_KN_2009.loc[:,"Total"]
s9_35 = np.sum(t_KN_2009)
s9_35
df_st_KER_2009 = df_2009.loc[(df_2009["State"]=="KERALA")]
df_st_KER_2009
t_KER_2009 = df_st_KER_2009.loc[:,"Total"]
s9_36 = np.sum(t_KER_2009)
s9_36
df_st_LD_2009 = df_2009.loc[(df_2009["State"]=="LAKSHADWEEP")]
df_st_LD_2009
t_LD_2009 = df_st_LD_2009.loc[:,"Total"]
s9_37 = np.sum(t_LD_2009)
s9_37
df_st_MP_2009 = df_2009.loc[(df_2009["State"]=="MADHYA PRADESH")]
df_st_MP_2009
t_MP_2009 = df_st_MP_2009.loc[:,"Total"]
s9_38 = np.sum(t_MP_2009)
s9_38
df_st_MH_2009 = df_2009.loc[(df_2009["State"]=="MAHARASHTRA")]
df_st_MH_2009
t_MH_2009 = df_st_MH_2009.loc[:,"Total"]
s9_39 = np.sum(t_MH_2009)
s9_39
df_st_MN_2009 = df_2009.loc[(df_2009["State"]=="MANIPUR")]
df_st_MN_2009
t_MN_2009 = df_st_MN_2009.loc[:,"Total"]
s9_40 = np.sum(t_MN_2009)
s9_40
df_st_MG_2009 = df_2009.loc[(df_2009["State"]=="MEGHALAYA")]
df_st_MG_2009
t_MG_2009 = df_st_MG_2009.loc[:,"Total"]
s9_41 = np.sum(t_MG_2009)
s9_41
df_st_MZ_2009 = df_2009.loc[(df_2009["State"]=="MIZORAM")]
df_st_MZ_2009
t_MN_2009 = df_st_MN_2009.loc[:,"Total"]
s9_42 = np.sum(t_MN_2009)
s9_42
df_st_NG_2009 = df_2009.loc[(df_2009["State"]=="NAGALAND")]
df_st_NG_2009
t_NG_2009 = df_st_NG_2009.loc[:,"Total"]
s9_43 = np.sum(t_NG_2009)
s9_43
df_st_OD_2009 = df_2009.loc[(df_2009["State"]=="ODISHA")]
df_st_OD_2009
t_OD_2009 = df_st_OD_2009.loc[:,"Total"]
s9_44 = np.sum(t_OD_2009)
s9_44
df_st_PD_2009 = df_2009.loc[(df_2009["State"]=="PUDUCHERRY")]
df_st_PD_2009
t_PD_2009 = df_st_PD_2009.loc[:,"Total"]
s9_45 = np.sum(t_PD_2009)
s9_45
df_st_PB_2009 = df_2009.loc[(df_2009["State"]=="PUNJAB")]
df_st_PB_2009
t_PB_2009 = df_st_PB_2009.loc[:,"Total"]
s9_46 = np.sum(t_PB_2009)
s9_46
df_st_RJ_2009 = df_2009.loc[(df_2009["State"]=="RAJASTHAN")]
df_st_RJ_2009
t_RJ_2009 = df_st_RJ_2009.loc[:,"Total"]
s9_47 = np.sum(t_RJ_2009)
s9_47
df_st_SM_2009 = df_2009.loc[(df_2009["State"]=="SIKKIM")]
df_st_SM_2009
t_SM_2009 = df_st_SM_2009.loc[:,"Total"]
s9_48 = np.sum(t_SM_2009)
s9_48
df_st_TN_2009 = df_2009.loc[(df_2009["State"]=="TAMIL NADU")]
df_st_TN_2009
t_TN_2009 = df_st_TN_2009.loc[:,"Total"]
s9_49 = np.sum(t_TN_2009)
s9_49
df_st_TP_2009 = df_2009.loc[(df_2009["State"]=="TRIPURA")]
df_st_TP_2009
t_TP_2009 = df_st_TP_2009.loc[:,"Total"]
s9_50 = np.sum(t_TP_2009)
s9_50
df_st_UP_2009 = df_2009.loc[(df_2009["State"]=="UTTAR PRADESH")]
df_st_UP_2009
t_UP_2009 = df_st_UP_2009.loc[:,"Total"]
s9_51 = np.sum(t_UP_2009)
s9_51
df_st_UK_2009 = df_2009.loc[(df_2009["State"]=="UTTARAKHAND")]
df_st_UK_2009
t_UK_2009 = df_st_UK_2009.loc[:,"Total"]
s9_52 = np.sum(t_UK_2009)
s9_52
df_st_WB_2009 = df_2009.loc[(df_2009["State"]=="WEST BENGAL")]
df_st_WB_2009
t_WB_2009 = df_st_WB_2009.loc[:,"Total"]
s9_53 = np.sum(t_WB_2009)
s9_53
t_ANm_2009 = np.sum(df_st_AN_2009.where(df_st_AN_2009["Gender"]=="Male")["Total"])
t_ANm_2009
t_ANfm_2009 = np.sum(df_st_AN_2009.where(df_st_AN_2009["Gender"]=="Female")["Total"])
t_ANfm_2009
t_APm_2009 = np.sum(df_st_AP_2009.where(df_st_AP_2009["Gender"]=="Male")["Total"])
t_APm_2009
t_APfm_2009 = np.sum(df_st_AP_2009.where(df_st_AP_2009["Gender"]=="Female")["Total"])
t_APfm_2009
t_ARPm_2009 = np.sum(df_st_ARP_2009.where(df_st_ARP_2009["Gender"]=="Male")["Total"])
t_ARPm_2009
t_ARPfm_2009 = np.sum(df_st_ARP_2009.where(df_st_ARP_2009["Gender"]=="Female")["Total"])
t_ARPfm_2009
t_ASm_2009 = np.sum(df_st_AS_2009.where(df_st_AS_2009["Gender"]=="Male")["Total"])
t_ASm_2009
t_ASfm_2009 = np.sum(df_st_AS_2009.where(df_st_AS_2009["Gender"]=="Female")["Total"])
t_ASfm_2009
t_BHm_2009 = np.sum(df_st_BH_2009.where(df_st_BH_2009["Gender"]=="Male")["Total"])
t_BHm_2009
t_BHfm_2009 = np.sum(df_st_BH_2009.where(df_st_BH_2009["Gender"]=="Female")["Total"])
t_BHfm_2009
t_CHm_2009 = np.sum(df_st_CH_2009.where(df_st_CH_2009["Gender"]=="Male")["Total"])
t_CHm_2009
t_CHfm_2009 = np.sum(df_st_CH_2009.where(df_st_CH_2009["Gender"]=="Female")["Total"])
t_CHfm_2009
t_CTm_2009 = np.sum(df_st_CT_2009.where(df_st_CT_2009["Gender"]=="Male")["Total"])
t_CTm_2009
t_CTfm_2009 = np.sum(df_st_CT_2009.where(df_st_CT_2009["Gender"]=="Female")["Total"])
t_CTfm_2009
t_DNm_2009 = np.sum(df_st_DN_2009.where(df_st_DN_2009["Gender"]=="Male")["Total"])
t_DNm_2009
t_DNfm_2009 = np.sum(df_st_DN_2009.where(df_st_DN_2009["Gender"]=="Female")["Total"])
t_DNfm_2009
t_DDm_2009 = np.sum(df_st_DD_2009.where(df_st_DD_2009["Gender"]=="Male")["Total"])
t_DDm_2009
t_DDfm_2009 = np.sum(df_st_DD_2009.where(df_st_DD_2009["Gender"]=="Female")["Total"])
t_DDfm_2009
t_DLm_2009 = np.sum(df_st_DL_2009.where(df_st_DL_2009["Gender"]=="Male")["Total"])
t_DLm_2009
t_DLfm_2009 = np.sum(df_st_DL_2009.where(df_st_DL_2009["Gender"]=="Female")["Total"])
t_DLfm_2009
t_GOAm_2009 = np.sum(df_st_GOA_2009.where(df_st_GOA_2009["Gender"]=="Male")["Total"])
t_GOAm_2009
t_GOAfm_2009 = np.sum(df_st_GOA_2009.where(df_st_GOA_2009["Gender"]=="Female")["Total"])
t_GOAfm_2009
t_GJm_2009 = np.sum(df_st_GJ_2009.where(df_st_GJ_2009["Gender"]=="Male")["Total"])
t_GJm_2009
t_GJfm_2009 = np.sum(df_st_GJ_2009.where(df_st_GJ_2009["Gender"]=="Female")["Total"])
t_GJfm_2009
t_HRm_2009 = np.sum(df_st_HR_2009.where(df_st_HR_2009["Gender"]=="Male")["Total"])
t_HRm_2009
t_HRfm_2009 = np.sum(df_st_HR_2009.where(df_st_HR_2009["Gender"]=="Female")["Total"])
t_HRfm_2009
t_HPm_2009 = np.sum(df_st_HP_2009.where(df_st_HP_2009["Gender"]=="Male")["Total"])
t_HPm_2009
t_HPfm_2009 = np.sum(df_st_HP_2009.where(df_st_HP_2009["Gender"]=="Female")["Total"])
t_HPfm_2009
t_JKm_2009 = np.sum(df_st_JK_2009.where(df_st_JK_2009["Gender"]=="Male")["Total"])
t_JKm_2009
t_JKfm_2009 = np.sum(df_st_JK_2009.where(df_st_JK_2009["Gender"]=="Female")["Total"])
t_JKfm_2009
t_JHm_2009 = np.sum(df_st_JH_2009.where(df_st_JH_2009["Gender"]=="Male")["Total"])
t_JHm_2009
t_JHfm_2009 = np.sum(df_st_JH_2009.where(df_st_JH_2009["Gender"]=="Female")["Total"])
t_JHfm_2009
t_KNm_2009 = np.sum(df_st_KN_2009.where(df_st_KN_2009["Gender"]=="Male")["Total"])
t_KNm_2009
t_KNfm_2009 = np.sum(df_st_KN_2009.where(df_st_KN_2009["Gender"]=="Female")["Total"])
t_KNfm_2009
t_KERm_2009 = np.sum(df_st_KER_2009.where(df_st_KER_2009["Gender"]=="Male")["Total"])
t_KERm_2009
t_KERfm_2009 = np.sum(df_st_KER_2009.where(df_st_KER_2009["Gender"]=="Female")["Total"])
t_KERfm_2009
t_LDm_2009 = np.sum(df_st_LD_2009.where(df_st_LD_2009["Gender"]=="Male")["Total"])
t_LDm_2009
t_LDfm_2009 = np.sum(df_st_LD_2009.where(df_st_LD_2009["Gender"]=="Female")["Total"])
t_LDfm_2009
t_MPm_2009 = np.sum(df_st_MP_2009.where(df_st_MP_2009["Gender"]=="Male")["Total"])
t_MPm_2009
t_MPfm_2009 = np.sum(df_st_MP_2009.where(df_st_MP_2009["Gender"]=="Female")["Total"])
t_MPfm_2009
t_MHm_2009 = np.sum(df_st_MH_2009.where(df_st_MH_2009["Gender"]=="Male")["Total"])
t_MHm_2009
t_MHfm_2009 = np.sum(df_st_MH_2009.where(df_st_MH_2009["Gender"]=="Female")["Total"])
t_MHfm_2009
t_MNm_2009 = np.sum(df_st_MN_2009.where(df_st_MN_2009["Gender"]=="Male")["Total"])
t_MNm_2009
t_MNfm_2009 = np.sum(df_st_MN_2009.where(df_st_MN_2009["Gender"]=="Female")["Total"])
t_MNfm_2009
t_MGm_2009 = np.sum(df_st_MG_2009.where(df_st_MG_2009["Gender"]=="Male")["Total"])
t_MGm_2009
t_MGfm_2009 = np.sum(df_st_MG_2009.where(df_st_MG_2009["Gender"]=="Female")["Total"])
t_MGfm_2009
t_MZm_2009 = np.sum(df_st_MZ_2009.where(df_st_MZ_2009["Gender"]=="Male")["Total"])
t_MZm_2009
t_MZfm_2009 = np.sum(df_st_MZ_2009.where(df_st_MZ_2009["Gender"]=="Female")["Total"])
t_MZfm_2009
t_NGm_2009 = np.sum(df_st_NG_2009.where(df_st_NG_2009["Gender"]=="Male")["Total"])
t_NGm_2009
t_NGfm_2009 = np.sum(df_st_NG_2009.where(df_st_NG_2009["Gender"]=="Female")["Total"])
t_MGfm_2009
t_ODm_2009 = np.sum(df_st_OD_2009.where(df_st_OD_2009["Gender"]=="Male")["Total"])
t_ODm_2009
t_ODfm_2009 = np.sum(df_st_OD_2009.where(df_st_OD_2009["Gender"]=="Female")["Total"])
t_ODfm_2009
t_PDm_2009 = np.sum(df_st_PD_2009.where(df_st_PD_2009["Gender"]=="Male")["Total"])
t_PDm_2009
t_PDfm_2009 = np.sum(df_st_PD_2009.where(df_st_PD_2009["Gender"]=="Female")["Total"])
t_PDfm_2009
t_PBm_2009 = np.sum(df_st_PB_2009.where(df_st_PB_2009["Gender"]=="Male")["Total"])
t_PBm_2009
t_PBfm_2009 = np.sum(df_st_PB_2009.where(df_st_PB_2009["Gender"]=="Female")["Total"])
t_PBfm_2009
t_RJm_2009 = np.sum(df_st_RJ_2009.where(df_st_RJ_2009["Gender"]=="Male")["Total"])
t_RJm_2009
t_RJfm_2009 = np.sum(df_st_RJ_2009.where(df_st_RJ_2009["Gender"]=="Female")["Total"])
t_RJfm_2009
t_SMm_2009 = np.sum(df_st_SM_2009.where(df_st_SM_2009["Gender"]=="Male")["Total"])
t_SMm_2009
t_SMfm_2009 = np.sum(df_st_SM_2009.where(df_st_SM_2009["Gender"]=="Female")["Total"])
t_SMfm_2009
t_TNm_2009 = np.sum(df_st_TN_2009.where(df_st_TN_2009["Gender"]=="Male")["Total"])
t_TNm_2009
t_TNfm_2009 = np.sum(df_st_TN_2009.where(df_st_TN_2009["Gender"]=="Female")["Total"])
t_TNfm_2009
t_TPm_2009 = np.sum(df_st_TP_2009.where(df_st_TP_2009["Gender"]=="Male")["Total"])
t_TPm_2009
t_TPfm_2009 = np.sum(df_st_TP_2009.where(df_st_TP_2009["Gender"]=="Female")["Total"])
t_TPfm_2009
t_UPm_2009 = np.sum(df_st_UP_2009.where(df_st_UP_2009["Gender"]=="Male")["Total"])
t_UPm_2009
t_UPfm_2009 = np.sum(df_st_UP_2009.where(df_st_UP_2009["Gender"]=="Female")["Total"])
t_UPfm_2009
t_UKm_2009 = np.sum(df_st_UK_2009.where(df_st_UK_2009["Gender"]=="Male")["Total"])
t_UKm_2009
t_UKfm_2009 = np.sum(df_st_UK_2009.where(df_st_UK_2009["Gender"]=="Female")["Total"])
t_UKfm_2009
t_WBm_2009 = np.sum(df_st_WB_2009.where(df_st_WB_2009["Gender"]=="Male")["Total"])
t_WBm_2009
t_WBfm_2009 = np.sum(df_st_WB_2009.where(df_st_WB_2009["Gender"]=="Female")["Total"])
t_WBfm_2009
l_2009=list(df_2009.loc[:,"Type"].unique())
l_2009.sort()
print(l_2009,end=" ")
cause_l_2009=[]
for i in l_2009:
rough= np.sum(df_2009.where(df_2009["Type"]==i)["Total"])
cause_l_2009.append(rough)
print(cause_l_2009,end=" ")
x1_2009 = set(df_2009.loc[:,"State"])
x1_2009
len(x1_2009)
cause_df_2009 = pd.DataFrame(cause_l_2009,l_2009)
cause_df_2009.reset_index()
cause_df_2009.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2009",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2009=list(df_2009.loc[:,"State"].unique())
s_2009.sort()
print(s_2009,end=" ")
state_s_2009 = [s9_19,s9_20,s9_21,s9_22,s9_23,s9_24,s9_25,s9_26,s9_27,s9_28,s9_29,s9_30,s9_31,s9_32,s9_33,s9_34,
s9_35,s9_36,s9_37,s9_38,s9_39,s9_40,s9_41,s9_42,s9_43,s9_44,s9_45,s9_46,s9_47,s9_48,s9_49,s9_50,
s9_51,s9_52,s9_53]
print(state_s_2009,end=" ")
state_m_2009=[t_ANm_2009, t_APm_2009, t_ARPm_2009, t_ASm_2009, t_BHm_2009, t_CHm_2009, t_CTm_2009, t_DNm_2009,
t_DDm_2009, t_DLm_2009, t_GOAm_2009, t_GJm_2009, t_HRm_2009, t_HPm_2009,t_JKm_2009, t_JHm_2009,
t_KNm_2009, t_KERm_2009, t_LDm_2009,t_MPm_2009,t_MHm_2009,t_MNm_2009,t_MGm_2009,t_MZm_2009,
t_NGm_2009, t_ODm_2009, t_PDm_2009,t_PBm_2009,t_RJm_2009,t_SMm_2009,t_TNm_2009,t_TPm_2009,
t_UPm_2009, t_UKm_2009, t_WBm_2009]
print(state_m_2009,end=" ")
state_fm_2009=[t_ANfm_2009, t_APfm_2009, t_ARPfm_2009, t_ASfm_2009, t_BHfm_2009, t_CHfm_2009, t_CTfm_2009, t_DNfm_2009,
t_DDfm_2009, t_DLfm_2009, t_GOAfm_2009, t_GJfm_2009, t_HRfm_2009, t_HPfm_2009,t_JKfm_2009, t_JHfm_2009,
t_KNfm_2009, t_KERfm_2009, t_LDfm_2009,t_MPfm_2009,t_MHfm_2009,t_MNfm_2009,t_MGfm_2009,t_MZfm_2009,
t_NGfm_2009, t_ODfm_2009, t_PDfm_2009,t_PBfm_2009,t_RJfm_2009,t_SMfm_2009,t_TNfm_2009,t_TPfm_2009,
t_UPfm_2009, t_UKfm_2009, t_WBfm_2009]
print(state_fm_2009,end=" ")
df_state_2009 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s9_19,s9_20,s9_21,s9_22,s9_23,s9_24,s9_25,s9_26,s9_27,s9_28,s9_29,s9_30,s9_31,s9_32,s9_33,s9_34,
s9_35,s9_36,s9_37,s9_38,s9_39,s9_40,s9_41,s9_42,s9_43,s9_44,s9_45,s9_46,s9_47,s9_48,s9_49,s9_50,
s9_51,s9_52,s9_53],
"Male":[t_ANm_2009, t_APm_2009, t_ARPm_2009, t_ASm_2009, t_BHm_2009, t_CHm_2009, t_CTm_2009, t_DNm_2009,
t_DDm_2009, t_DLm_2009, t_GOAm_2009, t_GJm_2009, t_HRm_2009, t_HPm_2009,t_JKm_2009, t_JHm_2009,
t_KNm_2009, t_KERm_2009, t_LDm_2009,t_MPm_2009,t_MHm_2009,t_MNm_2009,t_MGm_2009,t_MZm_2009,
t_NGm_2009, t_ODm_2009, t_PDm_2009,t_PBm_2009,t_RJm_2009,t_SMm_2009,t_TNm_2009,t_TPm_2009,
t_UPm_2009, t_UKm_2009, t_WBm_2009],
"Female":[t_ANfm_2009, t_APfm_2009, t_ARPfm_2009, t_ASfm_2009, t_BHfm_2009, t_CHfm_2009, t_CTfm_2009, t_DNfm_2009,
t_DDfm_2009, t_DLfm_2009, t_GOAfm_2009, t_GJfm_2009, t_HRfm_2009, t_HPfm_2009,t_JKfm_2009, t_JHfm_2009,
t_KNfm_2009, t_KERfm_2009, t_LDfm_2009,t_MPfm_2009,t_MHfm_2009,t_MNfm_2009,t_MGfm_2009,t_MZfm_2009,
t_NGfm_2009, t_ODfm_2009, t_PDfm_2009,t_PBfm_2009,t_RJfm_2009,t_SMfm_2009,t_TNfm_2009,t_TPfm_2009,
t_UPfm_2009, t_UKfm_2009, t_WBfm_2009]
}
df_All_st_2009 = pd.DataFrame(df_state_2009)
df_All_st_2009
pivot_2009 = pd.pivot_table(df_All_st_2009, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2009
pivot_2009.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2009=[]
for i in cause_l_2009:
p=i/np.sum(cause_l_2009)
avg_2009_cause=p*100
cause_l_percent_2009.append(avg_2009_cause)
print(cause_l_percent_2009,end=" ")
np.max(cause_l_percent_2009) #Married
np.min(cause_l_percent_2009) #Ideological Causes/Hero Worshipping
state_s_2009_percent=[]
tot=np.sum(state_s_2009)
for i in state_s_2009:
xy=i/tot
avg_state_2009=xy*100
state_s_2009_percent.append(avg_state_2009)
print(state_s_2009_percent,end=" ")
np.max(state_s_2009_percent) #Maharashtra
np.min(state_s_2009_percent) #Lakshdweep
l_age_grp_2009=[s9_4,s9_5,s9_6,s9_7,s9_8,s9_54]
l_age_grp_2009
l_age_grp_2009_percent=[]
for i in l_age_grp_2009:
yz=i/s9_1
avg_2009_age_grp=yz*100
l_age_grp_2009_percent.append(avg_2009_age_grp)
l_age_grp_2009_percent
np.max(l_age_grp_2009_percent) #0-100+
np.min(l_age_grp_2009_percent) #0-14
total_male_percent_2009= (s9_2/s9_1)*100
total_male_percent_2009
total_female_percent_2009= (s9_3/s9_1)*100
total_female_percent_2009
df_2010 = suicide_df.loc[(suicide_df["Year"]==2010)]
df_2010
t2010_dcount = df_2010.loc[:,"Total"]
s10_1 = np.sum(t2010_dcount)
s10_1
male_2010 = df_2010.loc[(df_2010["Gender"]=="Male")]
male_2010
m2010_count = male_2010.loc[:,"Total"]
s10_2 = np.sum(m2010_count)
s10_2
female_2010 = df_2010.loc[(df_2010["Gender"]=="Female")]
female_2010
fm2010_count = female_2010.loc[:,"Total"]
s10_3 = np.sum(fm2010_count)
s10_3
df_age_d014_2010 = df_2010.loc[(df_2010["Age_group"]=="0-14")]
df_age_d014_2010
t_014_2010 = df_age_d014_2010.loc[:,"Total"]
s10_4 = np.sum(t_014_2010)
s10_4
df_age_d1529_2010 = df_2010.loc[(df_2010["Age_group"]=="15-29")]
df_age_d1529_2010
t_1529_2010 = df_age_d1529_2010.loc[:,"Total"]
s10_5 = np.sum(t_1529_2010)
s10_5
df_age_d3044_2010 = df_2010.loc[(df_2010["Age_group"]=="30-44")]
df_age_d3044_2010
t_3044_2010 = df_age_d3044_2010.loc[:,"Total"]
s10_6 = np.sum(t_3044_2010)
s10_6
df_age_d4559_2010 = df_2010.loc[(df_2010["Age_group"]=="45-59")]
df_age_d4559_2010
t_4559_2010 = df_age_d4559_2010.loc[:,"Total"]
s10_7 = np.sum(t_4559_2010)
s10_7
df_age_d60_2010 = df_2010.loc[(df_2010["Age_group"]=="60+")]
df_age_d60_2010
t_60_2010 = df_age_d60_2010.loc[:,"Total"]
s10_8 = np.sum(t_60_2010)
s10_8
df_age_d0100_2010 = df_2010.loc[(df_2010["Age_group"]=="0-100+")]
df_age_d0100_2010
t_0100_2010 = df_age_d0100_2010.loc[:,"Total"]
s10_54 = np.sum(t_0100_2010)
s10_54
df_014m_2010 = df_age_d014_2010.loc[(df_age_d014_2010["Gender"]=="Male")]
df_014m_2010
t_014m_2010 = df_014m_2010.loc[:,"Total"]
s10_9 = np.sum(t_014m_2010)
s10_9
df_014fm_2010 = df_age_d014_2010.loc[(df_age_d014_2010["Gender"]=="Female")]
df_014fm_2010
t_014fm_2010 = df_014fm_2010.loc[:,"Total"]
s10_10 = np.sum(t_014fm_2010)
s10_10
df_1529m_2010 = df_age_d1529_2010.loc[(df_age_d1529_2010["Gender"]=="Male")]
df_1529m_2010
t_1529m_2010 = df_1529m_2010.loc[:,"Total"]
s10_11 = np.sum(t_1529m_2010)
s10_11
df_1529fm_2010 = df_age_d1529_2010.loc[(df_age_d1529_2010["Gender"]=="Female")]
df_1529fm_2010
t_1529fm_2010 = df_1529fm_2010.loc[:,"Total"]
s10_12 = np.sum(t_1529fm_2010)
s10_12
df_3044m_2010 = df_age_d3044_2010.loc[(df_age_d3044_2010["Gender"]=="Male")]
df_3044m_2010
t_3044m_2010 = df_3044m_2010.loc[:,"Total"]
s10_13 = np.sum(t_3044m_2010)
s10_13
df_3044fm_2010 = df_age_d3044_2010.loc[(df_age_d3044_2010["Gender"]=="Female")]
df_3044fm_2010
t_3044fm_2010 = df_3044fm_2010.loc[:,"Total"]
s10_14 = np.sum(t_3044fm_2010)
s10_14
df_4559m_2010 = df_age_d4559_2010.loc[(df_age_d4559_2010["Gender"]=="Male")]
df_4559m_2010
t_4559m_2010 = df_4559m_2010.loc[:,"Total"]
s10_15 = np.sum(t_4559m_2010)
s10_15
df_4559fm_2010 = df_age_d4559_2010.loc[(df_age_d4559_2010["Gender"]=="Female")]
df_4559fm_2010
t_4559fm_2010 = df_4559fm_2010.loc[:,"Total"]
s10_16 = np.sum(t_4559fm_2010)
s10_16
df_60m_2010 = df_age_d60_2010.loc[(df_age_d60_2010["Gender"]=="Male")]
df_60m_2010
t_60m_2010 = df_60m_2010.loc[:,"Total"]
s10_17 = np.sum(t_60m_2010)
s10_17
df_60fm_2010 = df_age_d60_2010.loc[(df_age_d60_2010["Gender"]=="Female")]
df_60fm_2010
t_60fm_2010 = df_60fm_2010.loc[:,"Total"]
s10_18 = np.sum(t_60fm_2010)
s10_18
df_0100fm_2010 = df_age_d0100_2010.loc[(df_age_d0100_2010["Gender"]=="Female")]
df_0100fm_2010
t_0100fm_2010 = df_0100fm_2010.loc[:,"Total"]
s10_55 = np.sum(t_0100fm_2010)
s10_55
df_0100m_2010 = df_age_d0100_2010.loc[(df_age_d0100_2010["Gender"]=="Male")]
df_0100m_2010
t_0100m_2010 = df_0100m_2010.loc[:,"Total"]
s10_56 = np.sum(t_0100m_2010)
s10_56
df_st_AN_2010 = df_2010.loc[(df_2010["State"]=="A & N ISLANDS")]
df_st_AN_2010
t_AN_2010 = df_st_AN_2010.loc[:,"Total"]
s10_19 = np.sum(t_AN_2010)
s10_19
df_st_AP_2010 = df_2010.loc[(df_2010["State"]=="ANDHRA PRADESH")]
df_st_AP_2010
t_AP_2010 = df_st_AP_2010.loc[:,"Total"]
s10_20 = np.sum(t_AP_2010)
s10_20
df_st_ARP_2010 = df_2010.loc[(df_2010["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2010
t_ARP_2010 = df_st_ARP_2010.loc[:,"Total"]
s10_21 = np.sum(t_ARP_2010)
s10_21
df_st_AS_2010 = df_2010.loc[(df_2010["State"]=="ASSAM")]
df_st_AS_2010
t_AS_2010 = df_st_AS_2010.loc[:,"Total"]
s10_22 = np.sum(t_AS_2010)
s10_22
df_st_BH_2010 = df_2010.loc[(df_2010["State"]=="BIHAR")]
df_st_BH_2010
t_BH_2010 = df_st_BH_2010.loc[:,"Total"]
s10_23 = np.sum(t_BH_2010)
s10_23
df_st_CH_2010 = df_2010.loc[(df_2010["State"]=="CHANDIGARH")]
df_st_CH_2010
t_CH_2010 = df_st_CH_2010.loc[:,"Total"]
s10_24 = np.sum(t_CH_2010)
s10_24
df_st_CT_2010 = df_2010.loc[(df_2010["State"]=="CHHATTISGARH")]
df_st_CT_2010
t_CT_2010 = df_st_CT_2010.loc[:,"Total"]
s10_25 = np.sum(t_CT_2010)
s10_25
df_st_DN_2010 = df_2010.loc[(df_2010["State"]=="D & N HAVELI")]
df_st_DN_2010
t_DN_2010 = df_st_DN_2010.loc[:,"Total"]
s10_26 = np.sum(t_DN_2010)
s10_26
df_st_DD_2010 = df_2010.loc[(df_2010["State"]=="DAMAN & DIU")]
df_st_DD_2010
t_DD_2010 = df_st_DD_2010.loc[:,"Total"]
s10_27 = np.sum(t_DD_2010)
s10_27
df_st_DL_2010 = df_2010.loc[(df_2010["State"]=="DELHI (UT)")]
df_st_DL_2010
t_DL_2010 = df_st_DL_2010.loc[:,"Total"]
s10_28 = np.sum(t_DL_2010)
s10_28
df_st_GOA_2010 = df_2010.loc[(df_2010["State"]=="GOA")]
df_st_GOA_2010
t_GOA_2010 = df_st_GOA_2010.loc[:,"Total"]
s10_29 = np.sum(t_GOA_2010)
s10_29
df_st_GJ_2010 = df_2010.loc[(df_2010["State"]=="GUJARAT")]
df_st_GJ_2010
t_GJ_2010 = df_st_GJ_2010.loc[:,"Total"]
s10_30 = np.sum(t_GJ_2010)
s10_30
df_st_HR_2010 = df_2010.loc[(df_2010["State"]=="HARYANA")]
df_st_HR_2010
t_HR_2010 = df_st_HR_2010.loc[:,"Total"]
s10_31 = np.sum(t_HR_2010)
s10_31
df_st_HP_2010 = df_2010.loc[(df_2010["State"]=="HIMACHAL PRADESH")]
df_st_HP_2010
t_HP_2010 = df_st_HP_2010.loc[:,"Total"]
s10_32 = np.sum(t_HP_2010)
s10_32
df_st_JK_2010 = df_2010.loc[(df_2010["State"]=="JAMMU & KASHMIR")]
df_st_JK_2010
t_JK_2010 = df_st_JK_2010.loc[:,"Total"]
s10_33 = np.sum(t_JK_2010)
s10_33
df_st_JH_2010 = df_2010.loc[(df_2010["State"]=="JHARKHAND")]
df_st_JH_2010
t_JH_2010 = df_st_JH_2010.loc[:,"Total"]
s10_34 = np.sum(t_JH_2010)
s10_34
df_st_KN_2010 = df_2010.loc[(df_2010["State"]=="KARNATAKA")]
df_st_KN_2010
t_KN_2010 = df_st_KN_2010.loc[:,"Total"]
s10_35 = np.sum(t_KN_2010)
s10_35
df_st_KER_2010 = df_2010.loc[(df_2010["State"]=="KERALA")]
df_st_KER_2010
t_KER_2010 = df_st_KER_2010.loc[:,"Total"]
s10_36 = np.sum(t_KER_2010)
s10_36
df_st_LD_2010 = df_2010.loc[(df_2010["State"]=="LAKSHADWEEP")]
df_st_LD_2010
t_LD_2010 = df_st_LD_2010.loc[:,"Total"]
s10_37 = np.sum(t_LD_2010)
s10_37
df_st_MP_2010 = df_2010.loc[(df_2010["State"]=="MADHYA PRADESH")]
df_st_MP_2010
t_MP_2010 = df_st_MP_2010.loc[:,"Total"]
s10_38 = np.sum(t_MP_2010)
s10_38
df_st_MH_2010 = df_2010.loc[(df_2010["State"]=="MAHARASHTRA")]
df_st_MH_2010
t_MH_2010 = df_st_MH_2010.loc[:,"Total"]
s10_39 = np.sum(t_MH_2010)
s10_39
df_st_MN_2010 = df_2010.loc[(df_2010["State"]=="MANIPUR")]
df_st_MN_2010
t_MN_2010 = df_st_MN_2010.loc[:,"Total"]
s10_40 = np.sum(t_MN_2010)
s10_40
df_st_MG_2010 = df_2010.loc[(df_2010["State"]=="MEGHALAYA")]
df_st_MG_2010
t_MG_2010 = df_st_MG_2010.loc[:,"Total"]
s10_41 = np.sum(t_MG_2010)
s10_41
df_st_MZ_2010 = df_2010.loc[(df_2010["State"]=="MIZORAM")]
df_st_MZ_2010
t_MN_2010 = df_st_MN_2010.loc[:,"Total"]
s10_42 = np.sum(t_MN_2010)
s10_42
df_st_NG_2010 = df_2010.loc[(df_2010["State"]=="NAGALAND")]
df_st_NG_2010
t_NG_2010 = df_st_NG_2010.loc[:,"Total"]
s10_43 = np.sum(t_NG_2010)
s10_43
df_st_OD_2010 = df_2010.loc[(df_2010["State"]=="ODISHA")]
df_st_OD_2010
t_OD_2010 = df_st_OD_2010.loc[:,"Total"]
s10_44 = np.sum(t_OD_2010)
s10_44
df_st_PD_2010 = df_2010.loc[(df_2010["State"]=="PUDUCHERRY")]
df_st_PD_2010
t_PD_2010 = df_st_PD_2010.loc[:,"Total"]
s10_45 = np.sum(t_PD_2010)
s10_45
df_st_PB_2010 = df_2010.loc[(df_2010["State"]=="PUNJAB")]
df_st_PB_2010
t_PB_2010 = df_st_PB_2010.loc[:,"Total"]
s10_46 = np.sum(t_PB_2010)
s10_46
df_st_RJ_2010 = df_2010.loc[(df_2010["State"]=="RAJASTHAN")]
df_st_RJ_2010
t_RJ_2010 = df_st_RJ_2010.loc[:,"Total"]
s10_47 = np.sum(t_RJ_2010)
s10_47
df_st_SM_2010 = df_2010.loc[(df_2010["State"]=="SIKKIM")]
df_st_SM_2010
t_SM_2010 = df_st_SM_2010.loc[:,"Total"]
s10_48 = np.sum(t_SM_2010)
s10_48
df_st_TN_2010 = df_2010.loc[(df_2010["State"]=="TAMIL NADU")]
df_st_TN_2010
t_TN_2010 = df_st_TN_2010.loc[:,"Total"]
s10_49 = np.sum(t_TN_2010)
s10_49
df_st_TP_2010 = df_2010.loc[(df_2010["State"]=="TRIPURA")]
df_st_TP_2010
t_TP_2010 = df_st_TP_2010.loc[:,"Total"]
s10_50 = np.sum(t_TP_2010)
s10_50
df_st_UP_2010 = df_2010.loc[(df_2010["State"]=="UTTAR PRADESH")]
df_st_UP_2010
t_UP_2010 = df_st_UP_2010.loc[:,"Total"]
s10_51 = np.sum(t_UP_2010)
s10_51
df_st_UK_2010 = df_2010.loc[(df_2010["State"]=="UTTARAKHAND")]
df_st_UK_2010
t_UK_2010 = df_st_UK_2010.loc[:,"Total"]
s10_52 = np.sum(t_UK_2010)
s10_52
df_st_WB_2010 = df_2010.loc[(df_2010["State"]=="WEST BENGAL")]
df_st_WB_2010
t_WB_2010 = df_st_WB_2010.loc[:,"Total"]
s10_53 = np.sum(t_WB_2010)
s10_53
t_ANm_2010 = np.sum(df_st_AN_2010.where(df_st_AN_2010["Gender"]=="Male")["Total"])
t_ANm_2010
t_ANfm_2010 = np.sum(df_st_AN_2010.where(df_st_AN_2010["Gender"]=="Female")["Total"])
t_ANfm_2010
t_APm_2010 = np.sum(df_st_AP_2010.where(df_st_AP_2010["Gender"]=="Male")["Total"])
t_APm_2010
t_APfm_2010 = np.sum(df_st_AP_2010.where(df_st_AP_2010["Gender"]=="Female")["Total"])
t_APfm_2010
t_ARPm_2010 = np.sum(df_st_ARP_2010.where(df_st_ARP_2010["Gender"]=="Male")["Total"])
t_ARPm_2010
t_ARPfm_2010 = np.sum(df_st_ARP_2010.where(df_st_ARP_2010["Gender"]=="Female")["Total"])
t_ARPfm_2010
t_ASm_2010 = np.sum(df_st_AS_2010.where(df_st_AS_2010["Gender"]=="Male")["Total"])
t_ASm_2010
t_ASfm_2010 = np.sum(df_st_AS_2010.where(df_st_AS_2010["Gender"]=="Female")["Total"])
t_ASfm_2010
t_BHm_2010 = np.sum(df_st_BH_2010.where(df_st_BH_2010["Gender"]=="Male")["Total"])
t_BHm_2010
t_BHfm_2010 = np.sum(df_st_BH_2010.where(df_st_BH_2010["Gender"]=="Female")["Total"])
t_BHfm_2010
t_CHm_2010 = np.sum(df_st_CH_2010.where(df_st_CH_2010["Gender"]=="Male")["Total"])
t_CHm_2010
t_CHfm_2010 = np.sum(df_st_CH_2010.where(df_st_CH_2010["Gender"]=="Female")["Total"])
t_CHfm_2010
t_CTm_2010 = np.sum(df_st_CT_2010.where(df_st_CT_2010["Gender"]=="Male")["Total"])
t_CTm_2010
t_CTfm_2010 = np.sum(df_st_CT_2010.where(df_st_CT_2010["Gender"]=="Female")["Total"])
t_CTfm_2010
t_DNm_2010 = np.sum(df_st_DN_2010.where(df_st_DN_2010["Gender"]=="Male")["Total"])
t_DNm_2010
t_DNfm_2010 = np.sum(df_st_DN_2010.where(df_st_DN_2010["Gender"]=="Female")["Total"])
t_DNfm_2010
t_DDm_2010 = np.sum(df_st_DD_2010.where(df_st_DD_2010["Gender"]=="Male")["Total"])
t_DDm_2010
t_DDfm_2010 = np.sum(df_st_DD_2010.where(df_st_DD_2010["Gender"]=="Female")["Total"])
t_DDfm_2010
t_DLm_2010 = np.sum(df_st_DL_2010.where(df_st_DL_2010["Gender"]=="Male")["Total"])
t_DLm_2010
t_DLfm_2010 = np.sum(df_st_DL_2010.where(df_st_DL_2010["Gender"]=="Female")["Total"])
t_DLfm_2010
t_GOAm_2010 = np.sum(df_st_GOA_2010.where(df_st_GOA_2010["Gender"]=="Male")["Total"])
t_GOAm_2010
t_GOAfm_2010 = np.sum(df_st_GOA_2010.where(df_st_GOA_2010["Gender"]=="Female")["Total"])
t_GOAfm_2010
t_GJm_2010 = np.sum(df_st_GJ_2010.where(df_st_GJ_2010["Gender"]=="Male")["Total"])
t_GJm_2010
t_GJfm_2010 = np.sum(df_st_GJ_2010.where(df_st_GJ_2010["Gender"]=="Female")["Total"])
t_GJfm_2010
t_HRm_2010 = np.sum(df_st_HR_2010.where(df_st_HR_2010["Gender"]=="Male")["Total"])
t_HRm_2010
t_HRfm_2010 = np.sum(df_st_HR_2010.where(df_st_HR_2010["Gender"]=="Female")["Total"])
t_HRfm_2010
t_HPm_2010 = np.sum(df_st_HP_2010.where(df_st_HP_2010["Gender"]=="Male")["Total"])
t_HPm_2010
t_HPfm_2010 = np.sum(df_st_HP_2010.where(df_st_HP_2010["Gender"]=="Female")["Total"])
t_HPfm_2010
t_JKm_2010 = np.sum(df_st_JK_2010.where(df_st_JK_2010["Gender"]=="Male")["Total"])
t_JKm_2010
t_JKfm_2010 = np.sum(df_st_JK_2010.where(df_st_JK_2010["Gender"]=="Female")["Total"])
t_JKfm_2010
t_JHm_2010 = np.sum(df_st_JH_2010.where(df_st_JH_2010["Gender"]=="Male")["Total"])
t_JHm_2010
t_JHfm_2010 = np.sum(df_st_JH_2010.where(df_st_JH_2010["Gender"]=="Female")["Total"])
t_JHfm_2010
t_KNm_2010 = np.sum(df_st_KN_2010.where(df_st_KN_2010["Gender"]=="Male")["Total"])
t_KNm_2010
t_KNfm_2010 = np.sum(df_st_KN_2010.where(df_st_KN_2010["Gender"]=="Female")["Total"])
t_KNfm_2010
t_KERm_2010 = np.sum(df_st_KER_2010.where(df_st_KER_2010["Gender"]=="Male")["Total"])
t_KERm_2010
t_KERfm_2010 = np.sum(df_st_KER_2010.where(df_st_KER_2010["Gender"]=="Female")["Total"])
t_KERfm_2010
t_LDm_2010 = np.sum(df_st_LD_2010.where(df_st_LD_2010["Gender"]=="Male")["Total"])
t_LDm_2010
t_LDfm_2010 = np.sum(df_st_LD_2010.where(df_st_LD_2010["Gender"]=="Female")["Total"])
t_LDfm_2010
t_MPm_2010 = np.sum(df_st_MP_2010.where(df_st_MP_2010["Gender"]=="Male")["Total"])
t_MPm_2010
t_MPfm_2010 = np.sum(df_st_MP_2010.where(df_st_MP_2010["Gender"]=="Female")["Total"])
t_MPfm_2010
t_MHm_2010 = np.sum(df_st_MH_2010.where(df_st_MH_2010["Gender"]=="Male")["Total"])
t_MHm_2010
t_MHfm_2010 = np.sum(df_st_MH_2010.where(df_st_MH_2010["Gender"]=="Female")["Total"])
t_MHfm_2010
t_MNm_2010 = np.sum(df_st_MN_2010.where(df_st_MN_2010["Gender"]=="Male")["Total"])
t_MNm_2010
t_MNfm_2010 = np.sum(df_st_MN_2010.where(df_st_MN_2010["Gender"]=="Female")["Total"])
t_MNfm_2010
t_MGm_2010 = np.sum(df_st_MG_2010.where(df_st_MG_2010["Gender"]=="Male")["Total"])
t_MGm_2010
t_MGfm_2010 = np.sum(df_st_MG_2010.where(df_st_MG_2010["Gender"]=="Female")["Total"])
t_MGfm_2010
t_MZm_2010 = np.sum(df_st_MZ_2010.where(df_st_MZ_2010["Gender"]=="Male")["Total"])
t_MZm_2010
t_MZfm_2010 = np.sum(df_st_MZ_2010.where(df_st_MZ_2010["Gender"]=="Female")["Total"])
t_MZfm_2010
t_NGm_2010 = np.sum(df_st_NG_2010.where(df_st_NG_2010["Gender"]=="Male")["Total"])
t_NGm_2010
t_NGfm_2010 = np.sum(df_st_NG_2010.where(df_st_NG_2010["Gender"]=="Female")["Total"])
t_MGfm_2010
t_ODm_2010 = np.sum(df_st_OD_2010.where(df_st_OD_2010["Gender"]=="Male")["Total"])
t_ODm_2010
t_ODfm_2010 = np.sum(df_st_OD_2010.where(df_st_OD_2010["Gender"]=="Female")["Total"])
t_ODfm_2010
t_PDm_2010 = np.sum(df_st_PD_2010.where(df_st_PD_2010["Gender"]=="Male")["Total"])
t_PDm_2010
t_PDfm_2010 = np.sum(df_st_PD_2010.where(df_st_PD_2010["Gender"]=="Female")["Total"])
t_PDfm_2010
t_PBm_2010 = np.sum(df_st_PB_2010.where(df_st_PB_2010["Gender"]=="Male")["Total"])
t_PBm_2010
t_PBfm_2010 = np.sum(df_st_PB_2010.where(df_st_PB_2010["Gender"]=="Female")["Total"])
t_PBfm_2010
t_RJm_2010 = np.sum(df_st_RJ_2010.where(df_st_RJ_2010["Gender"]=="Male")["Total"])
t_RJm_2010
t_RJfm_2010 = np.sum(df_st_RJ_2010.where(df_st_RJ_2010["Gender"]=="Female")["Total"])
t_RJfm_2010
t_SMm_2010 = np.sum(df_st_SM_2010.where(df_st_SM_2010["Gender"]=="Male")["Total"])
t_SMm_2010
t_SMfm_2010 = np.sum(df_st_SM_2010.where(df_st_SM_2010["Gender"]=="Female")["Total"])
t_SMfm_2010
t_TNm_2010 = np.sum(df_st_TN_2010.where(df_st_TN_2010["Gender"]=="Male")["Total"])
t_TNm_2010
t_TNfm_2010 = np.sum(df_st_TN_2010.where(df_st_TN_2010["Gender"]=="Female")["Total"])
t_TNfm_2010
t_TPm_2010 = np.sum(df_st_TP_2010.where(df_st_TP_2010["Gender"]=="Male")["Total"])
t_TPm_2010
t_TPfm_2010 = np.sum(df_st_TP_2010.where(df_st_TP_2010["Gender"]=="Female")["Total"])
t_TPfm_2010
t_UPm_2010 = np.sum(df_st_UP_2010.where(df_st_UP_2010["Gender"]=="Male")["Total"])
t_UPm_2010
t_UPfm_2010 = np.sum(df_st_UP_2010.where(df_st_UP_2010["Gender"]=="Female")["Total"])
t_UPfm_2010
t_UKm_2010 = np.sum(df_st_UK_2010.where(df_st_UK_2010["Gender"]=="Male")["Total"])
t_UKm_2010
t_UKfm_2010 = np.sum(df_st_UK_2010.where(df_st_UK_2010["Gender"]=="Female")["Total"])
t_UKfm_2010
t_WBm_2010 = np.sum(df_st_WB_2010.where(df_st_WB_2010["Gender"]=="Male")["Total"])
t_WBm_2010
t_WBfm_2010 = np.sum(df_st_WB_2010.where(df_st_WB_2010["Gender"]=="Female")["Total"])
t_WBfm_2010
l_2010=list(df_2010.loc[:,"Type"].unique())
l_2010.sort()
print(l_2010,end=" ")
cause_l_2010=[]
for i in l_2010:
rough= np.sum(df_2010.where(df_2010["Type"]==i)["Total"])
cause_l_2010.append(rough)
print(cause_l_2010,end=" ")
x1_2010 = set(df_2010.loc[:,"State"])
x1_2010
len(x1_2010)
cause_df_2010 = pd.DataFrame(cause_l_2010,l_2010)
cause_df_2010.reset_index()
cause_df_2010.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2010",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2010=list(df_2010.loc[:,"State"].unique())
s_2010.sort()
print(s_2010,end=" ")
state_s_2010 = [s10_19,s10_20,s10_21,s10_22,s10_23,s10_24,s10_25,s10_26,s10_27,s10_28,s10_29,s10_30,s10_31,s10_32,s10_33,s10_34,
s10_35,s10_36,s10_37,s10_38,s10_39,s10_40,s10_41,s10_42,s10_43,s10_44,s10_45,s10_46,s10_47,s10_48,s10_49,s10_50,
s10_51,s10_52,s10_53]
print(state_s_2010,end=" ")
state_m_2010=[t_ANm_2010, t_APm_2010, t_ARPm_2010, t_ASm_2010, t_BHm_2010, t_CHm_2010, t_CTm_2010, t_DNm_2010,
t_DDm_2010, t_DLm_2010, t_GOAm_2010, t_GJm_2010, t_HRm_2010, t_HPm_2010,t_JKm_2010, t_JHm_2010,
t_KNm_2010, t_KERm_2010, t_LDm_2010,t_MPm_2010,t_MHm_2010,t_MNm_2010,t_MGm_2010,t_MZm_2010,
t_NGm_2010, t_ODm_2010, t_PDm_2010,t_PBm_2010,t_RJm_2010,t_SMm_2010,t_TNm_2010,t_TPm_2010,
t_UPm_2010, t_UKm_2010, t_WBm_2010]
print(state_m_2010,end=" ")
state_fm_2010=[t_ANfm_2010, t_APfm_2010, t_ARPfm_2010, t_ASfm_2010, t_BHfm_2010, t_CHfm_2010, t_CTfm_2010, t_DNfm_2010,
t_DDfm_2010, t_DLfm_2010, t_GOAfm_2010, t_GJfm_2010, t_HRfm_2010, t_HPfm_2010,t_JKfm_2010, t_JHfm_2010,
t_KNfm_2010, t_KERfm_2010, t_LDfm_2010,t_MPfm_2010,t_MHfm_2010,t_MNfm_2010,t_MGfm_2010,t_MZfm_2010,
t_NGfm_2010, t_ODfm_2010, t_PDfm_2010,t_PBfm_2010,t_RJfm_2010,t_SMfm_2010,t_TNfm_2010,t_TPfm_2010,
t_UPfm_2010, t_UKfm_2010, t_WBfm_2010]
print(state_fm_2010,end=" ")
df_state_2010 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s10_19,s10_20,s10_21,s10_22,s10_23,s10_24,s10_25,s10_26,s10_27,s10_28,s10_29,s10_30,s10_31,s10_32,s10_33,s10_34,
s10_35,s10_36,s10_37,s10_38,s10_39,s10_40,s10_41,s10_42,s10_43,s10_44,s10_45,s10_46,s10_47,s10_48,s10_49,s10_50,
s10_51,s10_52,s10_53],
"Male":[t_ANm_2010, t_APm_2010, t_ARPm_2010, t_ASm_2010, t_BHm_2010, t_CHm_2010, t_CTm_2010, t_DNm_2010,
t_DDm_2010, t_DLm_2010, t_GOAm_2010, t_GJm_2010, t_HRm_2010, t_HPm_2010,t_JKm_2010, t_JHm_2010,
t_KNm_2010, t_KERm_2010, t_LDm_2010,t_MPm_2010,t_MHm_2010,t_MNm_2010,t_MGm_2010,t_MZm_2010,
t_NGm_2010, t_ODm_2010, t_PDm_2010,t_PBm_2010,t_RJm_2010,t_SMm_2010,t_TNm_2010,t_TPm_2010,
t_UPm_2010, t_UKm_2010, t_WBm_2010],
"Female":[t_ANfm_2010, t_APfm_2010, t_ARPfm_2010, t_ASfm_2010, t_BHfm_2010, t_CHfm_2010, t_CTfm_2010, t_DNfm_2010,
t_DDfm_2010, t_DLfm_2010, t_GOAfm_2010, t_GJfm_2010, t_HRfm_2010, t_HPfm_2010,t_JKfm_2010, t_JHfm_2010,
t_KNfm_2010, t_KERfm_2010, t_LDfm_2010,t_MPfm_2010,t_MHfm_2010,t_MNfm_2010,t_MGfm_2010,t_MZfm_2010,
t_NGfm_2010, t_ODfm_2010, t_PDfm_2010,t_PBfm_2010,t_RJfm_2010,t_SMfm_2010,t_TNfm_2010,t_TPfm_2010,
t_UPfm_2010, t_UKfm_2010, t_WBfm_2010]
}
df_All_st_2010 = pd.DataFrame(df_state_2010)
df_All_st_2010
pivot_2010 = pd.pivot_table(df_All_st_2010, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2010
pivot_2010.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2010=[]
for i in cause_l_2010:
p=i/np.sum(cause_l_2010)
avg_2010_cause=p*100
cause_l_percent_2010.append(avg_2010_cause)
print(cause_l_percent_2010,end=" ")
np.max(cause_l_percent_2010) #Married
np.min(cause_l_percent_2010) #Ideological Causes/Hero Worshipping
state_s_2010_percent=[]
tot=np.sum(state_s_2010)
for i in state_s_2010:
xy=i/tot
avg_state_2010=xy*100
state_s_2010_percent.append(avg_state_2010)
print(state_s_2010_percent,end=" ")
np.max(state_s_2010_percent) #Maharashtra
np.min(state_s_2010_percent) #Lakshdweep
l_age_grp_2010=[s10_4,s10_5,s10_6,s10_7,s10_8,s10_54]
l_age_grp_2010
l_age_grp_2010_percent=[]
for i in l_age_grp_2010:
yz=i/s10_1
avg_2010_age_grp=yz*100
l_age_grp_2010_percent.append(avg_2010_age_grp)
l_age_grp_2010_percent
np.max(l_age_grp_2010_percent) #0-100+
np.min(l_age_grp_2010_percent) #0-14
total_male_percent_2010= (s10_2/s10_1)*100
total_male_percent_2010
total_female_percent_2010= (s10_3/s10_1)*100
total_female_percent_2010
df_2011 = suicide_df.loc[(suicide_df["Year"]==2011)]
df_2011
t2011_dcount = df_2011.loc[:,"Total"]
s11_1 = np.sum(t2011_dcount)
s11_1
male_2011 = df_2011.loc[(df_2011["Gender"]=="Male")]
male_2011
m2011_count = male_2011.loc[:,"Total"]
s11_2 = np.sum(m2011_count)
s11_2
female_2011 = df_2011.loc[(df_2011["Gender"]=="Female")]
female_2011
fm2011_count = female_2011.loc[:,"Total"]
s11_3 = np.sum(fm2011_count)
s11_3
df_age_d014_2011 = df_2011.loc[(df_2011["Age_group"]=="0-14")]
df_age_d014_2011
t_014_2011 = df_age_d014_2011.loc[:,"Total"]
s11_4 = np.sum(t_014_2011)
s11_4
df_age_d1529_2011 = df_2011.loc[(df_2011["Age_group"]=="15-29")]
df_age_d1529_2011
t_1529_2011 = df_age_d1529_2011.loc[:,"Total"]
s11_5 = np.sum(t_1529_2011)
s11_5
df_age_d3044_2011 = df_2011.loc[(df_2011["Age_group"]=="30-44")]
df_age_d3044_2011
t_3044_2011 = df_age_d3044_2011.loc[:,"Total"]
s11_6 = np.sum(t_3044_2011)
s11_6
df_age_d4559_2011 = df_2011.loc[(df_2011["Age_group"]=="45-59")]
df_age_d4559_2011
t_4559_2011 = df_age_d4559_2011.loc[:,"Total"]
s11_7 = np.sum(t_4559_2011)
s11_7
df_age_d60_2011 = df_2011.loc[(df_2011["Age_group"]=="60+")]
df_age_d60_2011
t_60_2011 = df_age_d60_2011.loc[:,"Total"]
s11_8 = np.sum(t_60_2011)
s11_8
df_age_d0100_2011 = df_2011.loc[(df_2011["Age_group"]=="0-100+")]
df_age_d0100_2011
t_0100_2011 = df_age_d0100_2011.loc[:,"Total"]
s11_54 = np.sum(t_0100_2011)
s11_54
df_014m_2011 = df_age_d014_2011.loc[(df_age_d014_2011["Gender"]=="Male")]
df_014m_2011
t_014m_2011 = df_014m_2011.loc[:,"Total"]
s11_9 = np.sum(t_014m_2011)
s11_9
df_014fm_2011 = df_age_d014_2011.loc[(df_age_d014_2011["Gender"]=="Female")]
df_014fm_2011
t_014fm_2011 = df_014fm_2011.loc[:,"Total"]
s11_10 = np.sum(t_014fm_2011)
s11_10
df_1529m_2011 = df_age_d1529_2011.loc[(df_age_d1529_2011["Gender"]=="Male")]
df_1529m_2011
t_1529m_2011 = df_1529m_2011.loc[:,"Total"]
s11_11 = np.sum(t_1529m_2011)
s11_11
df_1529fm_2011 = df_age_d1529_2011.loc[(df_age_d1529_2011["Gender"]=="Female")]
df_1529fm_2011
t_1529fm_2011 = df_1529fm_2011.loc[:,"Total"]
s11_12 = np.sum(t_1529fm_2011)
s11_12
df_3044m_2011 = df_age_d3044_2011.loc[(df_age_d3044_2011["Gender"]=="Male")]
df_3044m_2011
t_3044m_2011 = df_3044m_2011.loc[:,"Total"]
s11_13 = np.sum(t_3044m_2011)
s11_13
df_3044fm_2011 = df_age_d3044_2011.loc[(df_age_d3044_2011["Gender"]=="Female")]
df_3044fm_2011
t_3044fm_2011 = df_3044fm_2011.loc[:,"Total"]
s11_14 = np.sum(t_3044fm_2011)
s11_14
df_4559m_2011 = df_age_d4559_2011.loc[(df_age_d4559_2011["Gender"]=="Male")]
df_4559m_2011
t_4559m_2011 = df_4559m_2011.loc[:,"Total"]
s11_15 = np.sum(t_4559m_2011)
s11_15
df_4559fm_2011 = df_age_d4559_2011.loc[(df_age_d4559_2011["Gender"]=="Female")]
df_4559fm_2011
t_4559fm_2011 = df_4559fm_2011.loc[:,"Total"]
s11_16 = np.sum(t_4559fm_2011)
s11_16
df_60m_2011 = df_age_d60_2011.loc[(df_age_d60_2011["Gender"]=="Male")]
df_60m_2011
t_60m_2011 = df_60m_2011.loc[:,"Total"]
s11_17 = np.sum(t_60m_2011)
s11_17
df_60fm_2011 = df_age_d60_2011.loc[(df_age_d60_2011["Gender"]=="Female")]
df_60fm_2011
t_60fm_2011 = df_60fm_2011.loc[:,"Total"]
s11_18 = np.sum(t_60fm_2011)
s11_18
df_0100fm_2011 = df_age_d0100_2011.loc[(df_age_d0100_2011["Gender"]=="Female")]
df_0100fm_2011
t_0100fm_2011 = df_0100fm_2011.loc[:,"Total"]
s11_55 = np.sum(t_0100fm_2011)
s11_55
df_0100m_2011 = df_age_d0100_2011.loc[(df_age_d0100_2011["Gender"]=="Male")]
df_0100m_2011
t_0100m_2011 = df_0100m_2011.loc[:,"Total"]
s11_56 = np.sum(t_0100m_2011)
s11_56
df_st_AN_2011 = df_2011.loc[(df_2011["State"]=="A & N ISLANDS")]
df_st_AN_2011
t_AN_2011 = df_st_AN_2011.loc[:,"Total"]
s11_19 = np.sum(t_AN_2011)
s11_19
df_st_AP_2011 = df_2011.loc[(df_2011["State"]=="ANDHRA PRADESH")]
df_st_AP_2011
t_AP_2011 = df_st_AP_2011.loc[:,"Total"]
s11_20 = np.sum(t_AP_2011)
s11_20
df_st_ARP_2011 = df_2011.loc[(df_2011["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2011
t_ARP_2011 = df_st_ARP_2011.loc[:,"Total"]
s11_21 = np.sum(t_ARP_2011)
s11_21
df_st_AS_2011 = df_2011.loc[(df_2011["State"]=="ASSAM")]
df_st_AS_2011
t_AS_2011 = df_st_AS_2011.loc[:,"Total"]
s11_22 = np.sum(t_AS_2011)
s11_22
df_st_BH_2011 = df_2011.loc[(df_2011["State"]=="BIHAR")]
df_st_BH_2011
t_BH_2011 = df_st_BH_2011.loc[:,"Total"]
s11_23 = np.sum(t_BH_2011)
s11_23
df_st_CH_2011 = df_2011.loc[(df_2011["State"]=="CHANDIGARH")]
df_st_CH_2011
t_CH_2011 = df_st_CH_2011.loc[:,"Total"]
s11_24 = np.sum(t_CH_2011)
s11_24
df_st_CT_2011 = df_2011.loc[(df_2011["State"]=="CHHATTISGARH")]
df_st_CT_2011
t_CT_2011 = df_st_CT_2011.loc[:,"Total"]
s11_25 = np.sum(t_CT_2011)
s11_25
df_st_DN_2011 = df_2011.loc[(df_2011["State"]=="D & N HAVELI")]
df_st_DN_2011
t_DN_2011 = df_st_DN_2011.loc[:,"Total"]
s11_26 = np.sum(t_DN_2011)
s11_26
df_st_DD_2011 = df_2011.loc[(df_2011["State"]=="DAMAN & DIU")]
df_st_DD_2011
t_DD_2011 = df_st_DD_2011.loc[:,"Total"]
s11_27 = np.sum(t_DD_2011)
s11_27
df_st_DL_2011 = df_2011.loc[(df_2011["State"]=="DELHI (UT)")]
df_st_DL_2011
t_DL_2011 = df_st_DL_2011.loc[:,"Total"]
s11_28 = np.sum(t_DL_2011)
s11_28
df_st_GOA_2011 = df_2011.loc[(df_2011["State"]=="GOA")]
df_st_GOA_2011
t_GOA_2011 = df_st_GOA_2011.loc[:,"Total"]
s11_29 = np.sum(t_GOA_2011)
s11_29
df_st_GJ_2011 = df_2011.loc[(df_2011["State"]=="GUJARAT")]
df_st_GJ_2011
t_GJ_2011 = df_st_GJ_2011.loc[:,"Total"]
s11_30 = np.sum(t_GJ_2011)
s11_30
df_st_HR_2011 = df_2011.loc[(df_2011["State"]=="HARYANA")]
df_st_HR_2011
t_HR_2011 = df_st_HR_2011.loc[:,"Total"]
s11_31 = np.sum(t_HR_2011)
s11_31
df_st_HP_2011 = df_2011.loc[(df_2011["State"]=="HIMACHAL PRADESH")]
df_st_HP_2011
t_HP_2011 = df_st_HP_2011.loc[:,"Total"]
s11_32 = np.sum(t_HP_2011)
s11_32
df_st_JK_2011 = df_2011.loc[(df_2011["State"]=="JAMMU & KASHMIR")]
df_st_JK_2011
t_JK_2011 = df_st_JK_2011.loc[:,"Total"]
s11_33 = np.sum(t_JK_2011)
s11_33
df_st_JH_2011 = df_2011.loc[(df_2011["State"]=="JHARKHAND")]
df_st_JH_2011
t_JH_2011 = df_st_JH_2011.loc[:,"Total"]
s11_34 = np.sum(t_JH_2011)
s11_34
df_st_KN_2011 = df_2011.loc[(df_2011["State"]=="KARNATAKA")]
df_st_KN_2011
t_KN_2011 = df_st_KN_2011.loc[:,"Total"]
s11_35 = np.sum(t_KN_2011)
s11_35
df_st_KER_2011 = df_2011.loc[(df_2011["State"]=="KERALA")]
df_st_KER_2011
t_KER_2011 = df_st_KER_2011.loc[:,"Total"]
s11_36 = np.sum(t_KER_2011)
s11_36
df_st_LD_2011 = df_2011.loc[(df_2011["State"]=="LAKSHADWEEP")]
df_st_LD_2011
t_LD_2011 = df_st_LD_2011.loc[:,"Total"]
s11_37 = np.sum(t_LD_2011)
s11_37
df_st_MP_2011 = df_2011.loc[(df_2011["State"]=="MADHYA PRADESH")]
df_st_MP_2011
t_MP_2011 = df_st_MP_2011.loc[:,"Total"]
s11_38 = np.sum(t_MP_2011)
s11_38
df_st_MH_2011 = df_2011.loc[(df_2011["State"]=="MAHARASHTRA")]
df_st_MH_2011
t_MH_2011 = df_st_MH_2011.loc[:,"Total"]
s11_39 = np.sum(t_MH_2011)
s11_39
df_st_MN_2011 = df_2011.loc[(df_2011["State"]=="MANIPUR")]
df_st_MN_2011
t_MN_2011 = df_st_MN_2011.loc[:,"Total"]
s11_40 = np.sum(t_MN_2011)
s11_40
df_st_MG_2011 = df_2011.loc[(df_2011["State"]=="MEGHALAYA")]
df_st_MG_2011
t_MG_2011 = df_st_MG_2011.loc[:,"Total"]
s11_41 = np.sum(t_MG_2011)
s11_41
df_st_MZ_2011 = df_2011.loc[(df_2011["State"]=="MIZORAM")]
df_st_MZ_2011
t_MN_2011 = df_st_MN_2011.loc[:,"Total"]
s11_42 = np.sum(t_MN_2011)
s11_42
df_st_NG_2011 = df_2011.loc[(df_2011["State"]=="NAGALAND")]
df_st_NG_2011
t_NG_2011 = df_st_NG_2011.loc[:,"Total"]
s11_43 = np.sum(t_NG_2011)
s11_43
df_st_OD_2011 = df_2011.loc[(df_2011["State"]=="ODISHA")]
df_st_OD_2011
t_OD_2011 = df_st_OD_2011.loc[:,"Total"]
s11_44 = np.sum(t_OD_2011)
s11_44
df_st_PD_2011 = df_2011.loc[(df_2011["State"]=="PUDUCHERRY")]
df_st_PD_2011
t_PD_2011 = df_st_PD_2011.loc[:,"Total"]
s11_45 = np.sum(t_PD_2011)
s11_45
df_st_PB_2011 = df_2011.loc[(df_2011["State"]=="PUNJAB")]
df_st_PB_2011
t_PB_2011 = df_st_PB_2011.loc[:,"Total"]
s11_46 = np.sum(t_PB_2011)
s11_46
df_st_RJ_2011 = df_2011.loc[(df_2011["State"]=="RAJASTHAN")]
df_st_RJ_2011
t_RJ_2011 = df_st_RJ_2011.loc[:,"Total"]
s11_47 = np.sum(t_RJ_2011)
s11_47
df_st_SM_2011 = df_2011.loc[(df_2011["State"]=="SIKKIM")]
df_st_SM_2011
t_SM_2011 = df_st_SM_2011.loc[:,"Total"]
s11_48 = np.sum(t_SM_2011)
s11_48
df_st_TN_2011 = df_2011.loc[(df_2011["State"]=="TAMIL NADU")]
df_st_TN_2011
t_TN_2011 = df_st_TN_2011.loc[:,"Total"]
s11_49 = np.sum(t_TN_2011)
s11_49
df_st_TP_2011 = df_2011.loc[(df_2011["State"]=="TRIPURA")]
df_st_TP_2011
t_TP_2011 = df_st_TP_2011.loc[:,"Total"]
s11_50 = np.sum(t_TP_2011)
s11_50
df_st_UP_2011 = df_2011.loc[(df_2011["State"]=="UTTAR PRADESH")]
df_st_UP_2011
t_UP_2011 = df_st_UP_2011.loc[:,"Total"]
s11_51 = np.sum(t_UP_2011)
s11_51
df_st_UK_2011 = df_2011.loc[(df_2011["State"]=="UTTARAKHAND")]
df_st_UK_2011
t_UK_2011 = df_st_UK_2011.loc[:,"Total"]
s11_52 = np.sum(t_UK_2011)
s11_52
df_st_WB_2011 = df_2011.loc[(df_2011["State"]=="WEST BENGAL")]
df_st_WB_2011
t_WB_2011 = df_st_WB_2011.loc[:,"Total"]
s11_53 = np.sum(t_WB_2011)
s11_53
t_ANm_2011 = np.sum(df_st_AN_2011.where(df_st_AN_2011["Gender"]=="Male")["Total"])
t_ANm_2011
t_ANfm_2011 = np.sum(df_st_AN_2011.where(df_st_AN_2011["Gender"]=="Female")["Total"])
t_ANfm_2011
t_APm_2011 = np.sum(df_st_AP_2011.where(df_st_AP_2011["Gender"]=="Male")["Total"])
t_APm_2011
t_APfm_2011 = np.sum(df_st_AP_2011.where(df_st_AP_2011["Gender"]=="Female")["Total"])
t_APfm_2011
t_ARPm_2011 = np.sum(df_st_ARP_2011.where(df_st_ARP_2011["Gender"]=="Male")["Total"])
t_ARPm_2011
t_ARPfm_2011 = np.sum(df_st_ARP_2011.where(df_st_ARP_2011["Gender"]=="Female")["Total"])
t_ARPfm_2011
t_ASm_2011 = np.sum(df_st_AS_2011.where(df_st_AS_2011["Gender"]=="Male")["Total"])
t_ASm_2011
t_ASfm_2011 = np.sum(df_st_AS_2011.where(df_st_AS_2011["Gender"]=="Female")["Total"])
t_ASfm_2011
t_BHm_2011 = np.sum(df_st_BH_2011.where(df_st_BH_2011["Gender"]=="Male")["Total"])
t_BHm_2011
t_BHfm_2011 = np.sum(df_st_BH_2011.where(df_st_BH_2011["Gender"]=="Female")["Total"])
t_BHfm_2011
t_CHm_2011 = np.sum(df_st_CH_2011.where(df_st_CH_2011["Gender"]=="Male")["Total"])
t_CHm_2011
t_CHfm_2011 = np.sum(df_st_CH_2011.where(df_st_CH_2011["Gender"]=="Female")["Total"])
t_CHfm_2011
t_CTm_2011 = np.sum(df_st_CT_2011.where(df_st_CT_2011["Gender"]=="Male")["Total"])
t_CTm_2011
t_CTfm_2011 = np.sum(df_st_CT_2011.where(df_st_CT_2011["Gender"]=="Female")["Total"])
t_CTfm_2011
t_DNm_2011 = np.sum(df_st_DN_2011.where(df_st_DN_2011["Gender"]=="Male")["Total"])
t_DNm_2011
t_DNfm_2011 = np.sum(df_st_DN_2011.where(df_st_DN_2011["Gender"]=="Female")["Total"])
t_DNfm_2011
t_DDm_2011 = np.sum(df_st_DD_2011.where(df_st_DD_2011["Gender"]=="Male")["Total"])
t_DDm_2011
t_DDfm_2011 = np.sum(df_st_DD_2011.where(df_st_DD_2011["Gender"]=="Female")["Total"])
t_DDfm_2011
t_DLm_2011 = np.sum(df_st_DL_2011.where(df_st_DL_2011["Gender"]=="Male")["Total"])
t_DLm_2011
t_DLfm_2011 = np.sum(df_st_DL_2011.where(df_st_DL_2011["Gender"]=="Female")["Total"])
t_DLfm_2011
t_GOAm_2011 = np.sum(df_st_GOA_2011.where(df_st_GOA_2011["Gender"]=="Male")["Total"])
t_GOAm_2011
t_GOAfm_2011 = np.sum(df_st_GOA_2011.where(df_st_GOA_2011["Gender"]=="Female")["Total"])
t_GOAfm_2011
t_GJm_2011 = np.sum(df_st_GJ_2011.where(df_st_GJ_2011["Gender"]=="Male")["Total"])
t_GJm_2011
t_GJfm_2011 = np.sum(df_st_GJ_2011.where(df_st_GJ_2011["Gender"]=="Female")["Total"])
t_GJfm_2011
t_HRm_2011 = np.sum(df_st_HR_2011.where(df_st_HR_2011["Gender"]=="Male")["Total"])
t_HRm_2011
t_HRfm_2011 = np.sum(df_st_HR_2011.where(df_st_HR_2011["Gender"]=="Female")["Total"])
t_HRfm_2011
t_HPm_2011 = np.sum(df_st_HP_2011.where(df_st_HP_2011["Gender"]=="Male")["Total"])
t_HPm_2011
t_HPfm_2011 = np.sum(df_st_HP_2011.where(df_st_HP_2011["Gender"]=="Female")["Total"])
t_HPfm_2011
t_JKm_2011 = np.sum(df_st_JK_2011.where(df_st_JK_2011["Gender"]=="Male")["Total"])
t_JKm_2011
t_JKfm_2011 = np.sum(df_st_JK_2011.where(df_st_JK_2011["Gender"]=="Female")["Total"])
t_JKfm_2011
t_JHm_2011 = np.sum(df_st_JH_2011.where(df_st_JH_2011["Gender"]=="Male")["Total"])
t_JHm_2011
t_JHfm_2011 = np.sum(df_st_JH_2011.where(df_st_JH_2011["Gender"]=="Female")["Total"])
t_JHfm_2011
t_KNm_2011 = np.sum(df_st_KN_2011.where(df_st_KN_2011["Gender"]=="Male")["Total"])
t_KNm_2011
t_KNfm_2011 = np.sum(df_st_KN_2011.where(df_st_KN_2011["Gender"]=="Female")["Total"])
t_KNfm_2011
t_KERm_2011 = np.sum(df_st_KER_2011.where(df_st_KER_2011["Gender"]=="Male")["Total"])
t_KERm_2011
t_KERfm_2011 = np.sum(df_st_KER_2011.where(df_st_KER_2011["Gender"]=="Female")["Total"])
t_KERfm_2011
t_LDm_2011 = np.sum(df_st_LD_2011.where(df_st_LD_2011["Gender"]=="Male")["Total"])
t_LDm_2011
t_LDfm_2011 = np.sum(df_st_LD_2011.where(df_st_LD_2011["Gender"]=="Female")["Total"])
t_LDfm_2011
t_MPm_2011 = np.sum(df_st_MP_2011.where(df_st_MP_2011["Gender"]=="Male")["Total"])
t_MPm_2011
t_MPfm_2011 = np.sum(df_st_MP_2011.where(df_st_MP_2011["Gender"]=="Female")["Total"])
t_MPfm_2011
t_MHm_2011 = np.sum(df_st_MH_2011.where(df_st_MH_2011["Gender"]=="Male")["Total"])
t_MHm_2011
t_MHfm_2011 = np.sum(df_st_MH_2011.where(df_st_MH_2011["Gender"]=="Female")["Total"])
t_MHfm_2011
t_MNm_2011 = np.sum(df_st_MN_2011.where(df_st_MN_2011["Gender"]=="Male")["Total"])
t_MNm_2011
t_MNfm_2011 = np.sum(df_st_MN_2011.where(df_st_MN_2011["Gender"]=="Female")["Total"])
t_MNfm_2011
t_MGm_2011 = np.sum(df_st_MG_2011.where(df_st_MG_2011["Gender"]=="Male")["Total"])
t_MGm_2011
t_MGfm_2011 = np.sum(df_st_MG_2011.where(df_st_MG_2011["Gender"]=="Female")["Total"])
t_MGfm_2011
t_MZm_2011 = np.sum(df_st_MZ_2011.where(df_st_MZ_2011["Gender"]=="Male")["Total"])
t_MZm_2011
t_MZfm_2011 = np.sum(df_st_MZ_2011.where(df_st_MZ_2011["Gender"]=="Female")["Total"])
t_MZfm_2011
t_NGm_2011 = np.sum(df_st_NG_2011.where(df_st_NG_2011["Gender"]=="Male")["Total"])
t_NGm_2011
t_NGfm_2011 = np.sum(df_st_NG_2011.where(df_st_NG_2011["Gender"]=="Female")["Total"])
t_MGfm_2011
t_ODm_2011 = np.sum(df_st_OD_2011.where(df_st_OD_2011["Gender"]=="Male")["Total"])
t_ODm_2011
t_ODfm_2011 = np.sum(df_st_OD_2011.where(df_st_OD_2011["Gender"]=="Female")["Total"])
t_ODfm_2011
t_PDm_2011 = np.sum(df_st_PD_2011.where(df_st_PD_2011["Gender"]=="Male")["Total"])
t_PDm_2011
t_PDfm_2011 = np.sum(df_st_PD_2011.where(df_st_PD_2011["Gender"]=="Female")["Total"])
t_PDfm_2011
t_PBm_2011 = np.sum(df_st_PB_2011.where(df_st_PB_2011["Gender"]=="Male")["Total"])
t_PBm_2011
t_PBfm_2011 = np.sum(df_st_PB_2011.where(df_st_PB_2011["Gender"]=="Female")["Total"])
t_PBfm_2011
t_RJm_2011 = np.sum(df_st_RJ_2011.where(df_st_RJ_2011["Gender"]=="Male")["Total"])
t_RJm_2011
t_RJfm_2011 = np.sum(df_st_RJ_2011.where(df_st_RJ_2011["Gender"]=="Female")["Total"])
t_RJfm_2011
t_SMm_2011 = np.sum(df_st_SM_2011.where(df_st_SM_2011["Gender"]=="Male")["Total"])
t_SMm_2011
t_SMfm_2011 = np.sum(df_st_SM_2011.where(df_st_SM_2011["Gender"]=="Female")["Total"])
t_SMfm_2011
t_TNm_2011 = np.sum(df_st_TN_2011.where(df_st_TN_2011["Gender"]=="Male")["Total"])
t_TNm_2011
t_TNfm_2011 = np.sum(df_st_TN_2011.where(df_st_TN_2011["Gender"]=="Female")["Total"])
t_TNfm_2011
t_TPm_2011 = np.sum(df_st_TP_2011.where(df_st_TP_2011["Gender"]=="Male")["Total"])
t_TPm_2011
t_TPfm_2011 = np.sum(df_st_TP_2011.where(df_st_TP_2011["Gender"]=="Female")["Total"])
t_TPfm_2011
t_UPm_2011 = np.sum(df_st_UP_2011.where(df_st_UP_2011["Gender"]=="Male")["Total"])
t_UPm_2011
t_UPfm_2011 = np.sum(df_st_UP_2011.where(df_st_UP_2011["Gender"]=="Female")["Total"])
t_UPfm_2011
t_UKm_2011 = np.sum(df_st_UK_2011.where(df_st_UK_2011["Gender"]=="Male")["Total"])
t_UKm_2011
t_UKfm_2011 = np.sum(df_st_UK_2011.where(df_st_UK_2011["Gender"]=="Female")["Total"])
t_UKfm_2011
t_WBm_2011 = np.sum(df_st_WB_2011.where(df_st_WB_2011["Gender"]=="Male")["Total"])
t_WBm_2011
t_WBfm_2011 = np.sum(df_st_WB_2011.where(df_st_WB_2011["Gender"]=="Female")["Total"])
t_WBfm_2011
l_2011=list(df_2011.loc[:,"Type"].unique())
l_2011.sort()
print(l_2011,end=" ")
cause_l_2011=[]
for i in l_2011:
rough= np.sum(df_2011.where(df_2011["Type"]==i)["Total"])
cause_l_2011.append(rough)
print(cause_l_2011,end=" ")
x1_2011 = set(df_2011.loc[:,"State"])
x1_2011
len(x1_2011)
cause_df_2011 = pd.DataFrame(cause_l_2011,l_2011)
cause_df_2011.reset_index()
cause_df_2011.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2011",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2011=list(df_2011.loc[:,"State"].unique())
s_2011.sort()
print(s_2011,end=" ")
state_s_2011 = [s11_19,s11_20,s11_21,s11_22,s11_23,s11_24,s11_25,s11_26,s11_27,s11_28,s11_29,s11_30,s11_31,s11_32,s11_33,s11_34,
s11_35,s11_36,s11_37,s11_38,s11_39,s11_40,s11_41,s11_42,s11_43,s11_44,s11_45,s11_46,s11_47,s11_48,s11_49,s11_50,
s11_51,s11_52,s11_53]
print(state_s_2011,end=" ")
state_m_2011=[t_ANm_2011, t_APm_2011, t_ARPm_2011, t_ASm_2011, t_BHm_2011, t_CHm_2011, t_CTm_2011, t_DNm_2011,
t_DDm_2011, t_DLm_2011, t_GOAm_2011, t_GJm_2011, t_HRm_2011, t_HPm_2011,t_JKm_2011, t_JHm_2011,
t_KNm_2011, t_KERm_2011, t_LDm_2011,t_MPm_2011,t_MHm_2011,t_MNm_2011,t_MGm_2011,t_MZm_2011,
t_NGm_2011, t_ODm_2011, t_PDm_2011,t_PBm_2011,t_RJm_2011,t_SMm_2011,t_TNm_2011,t_TPm_2011,
t_UPm_2011, t_UKm_2011, t_WBm_2011]
print(state_m_2011,end=" ")
state_fm_2011=[t_ANfm_2011, t_APfm_2011, t_ARPfm_2011, t_ASfm_2011, t_BHfm_2011, t_CHfm_2011, t_CTfm_2011, t_DNfm_2011,
t_DDfm_2011, t_DLfm_2011, t_GOAfm_2011, t_GJfm_2011, t_HRfm_2011, t_HPfm_2011,t_JKfm_2011, t_JHfm_2011,
t_KNfm_2011, t_KERfm_2011, t_LDfm_2011,t_MPfm_2011,t_MHfm_2011,t_MNfm_2011,t_MGfm_2011,t_MZfm_2011,
t_NGfm_2011, t_ODfm_2011, t_PDfm_2011,t_PBfm_2011,t_RJfm_2011,t_SMfm_2011,t_TNfm_2011,t_TPfm_2011,
t_UPfm_2011, t_UKfm_2011, t_WBfm_2011]
print(state_fm_2011,end=" ")
df_state_2011 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s11_19,s11_20,s11_21,s11_22,s11_23,s11_24,s11_25,s11_26,s11_27,s11_28,s11_29,s11_30,s11_31,s11_32,s11_33,s11_34,
s11_35,s11_36,s11_37,s11_38,s11_39,s11_40,s11_41,s11_42,s11_43,s11_44,s11_45,s11_46,s11_47,s11_48,s11_49,s11_50,
s11_51,s11_52,s11_53],
"Male":[t_ANm_2011, t_APm_2011, t_ARPm_2011, t_ASm_2011, t_BHm_2011, t_CHm_2011, t_CTm_2011, t_DNm_2011,
t_DDm_2011, t_DLm_2011, t_GOAm_2011, t_GJm_2011, t_HRm_2011, t_HPm_2011,t_JKm_2011, t_JHm_2011,
t_KNm_2011, t_KERm_2011, t_LDm_2011,t_MPm_2011,t_MHm_2011,t_MNm_2011,t_MGm_2011,t_MZm_2011,
t_NGm_2011, t_ODm_2011, t_PDm_2011,t_PBm_2011,t_RJm_2011,t_SMm_2011,t_TNm_2011,t_TPm_2011,
t_UPm_2011, t_UKm_2011, t_WBm_2011],
"Female":[t_ANfm_2011, t_APfm_2011, t_ARPfm_2011, t_ASfm_2011, t_BHfm_2011, t_CHfm_2011, t_CTfm_2011, t_DNfm_2011,
t_DDfm_2011, t_DLfm_2011, t_GOAfm_2011, t_GJfm_2011, t_HRfm_2011, t_HPfm_2011,t_JKfm_2011, t_JHfm_2011,
t_KNfm_2011, t_KERfm_2011, t_LDfm_2011,t_MPfm_2011,t_MHfm_2011,t_MNfm_2011,t_MGfm_2011,t_MZfm_2011,
t_NGfm_2011, t_ODfm_2011, t_PDfm_2011,t_PBfm_2011,t_RJfm_2011,t_SMfm_2011,t_TNfm_2011,t_TPfm_2011,
t_UPfm_2011, t_UKfm_2011, t_WBfm_2011]
}
df_All_st_2011 = pd.DataFrame(df_state_2011)
df_All_st_2011
pivot_2011 = pd.pivot_table(df_All_st_2011, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2011
pivot_2011.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2011=[]
for i in cause_l_2011:
p=i/np.sum(cause_l_2011)
avg_2011_cause=p*100
cause_l_percent_2011.append(avg_2011_cause)
print(cause_l_percent_2011,end=" ")
np.max(cause_l_percent_2011) #Married
np.min(cause_l_percent_2011) #Ideological Causes/Hero Worshipping
state_s_2011_percent=[]
tot=np.sum(state_s_2011)
for i in state_s_2011:
xy=i/tot
avg_state_2011=xy*100
state_s_2011_percent.append(avg_state_2011)
print(state_s_2011_percent,end=" ")
np.max(state_s_2011_percent) #Maharashtra
np.min(state_s_2011_percent) #Lakshdweep
l_age_grp_2011=[s11_4,s11_5,s11_6,s11_7,s11_8,s11_54]
l_age_grp_2011
l_age_grp_2011_percent=[]
for i in l_age_grp_2011:
yz=i/s11_1
avg_2011_age_grp=yz*100
l_age_grp_2011_percent.append(avg_2011_age_grp)
l_age_grp_2011_percent
np.max(l_age_grp_2011_percent) #0-100+
np.min(l_age_grp_2011_percent) #0-14
total_male_percent_2011= (s11_2/s11_1)*100
total_male_percent_2011
total_female_percent_2011= (s11_3/s11_1)*100
total_female_percent_2011
df_2012 = suicide_df.loc[(suicide_df["Year"]==2012)]
df_2012
t2012_dcount = df_2012.loc[:,"Total"]
s12_1 = np.sum(t2012_dcount)
s12_1
male_2012 = df_2012.loc[(df_2012["Gender"]=="Male")]
male_2012
m2012_count = male_2012.loc[:,"Total"]
s12_2 = np.sum(m2012_count)
s12_2
female_2012 = df_2012.loc[(df_2012["Gender"]=="Female")]
female_2012
fm2012_count = female_2012.loc[:,"Total"]
s12_3 = np.sum(fm2012_count)
s12_3
df_age_d014_2012 = df_2012.loc[(df_2012["Age_group"]=="0-14")]
df_age_d014_2012
t_014_2012 = df_age_d014_2012.loc[:,"Total"]
s12_4 = np.sum(t_014_2012)
s12_4
df_age_d1529_2012 = df_2012.loc[(df_2012["Age_group"]=="15-29")]
df_age_d1529_2012
t_1529_2012 = df_age_d1529_2012.loc[:,"Total"]
s12_5 = np.sum(t_1529_2012)
s12_5
df_age_d3044_2012 = df_2012.loc[(df_2012["Age_group"]=="30-44")]
df_age_d3044_2012
t_3044_2012 = df_age_d3044_2012.loc[:,"Total"]
s12_6 = np.sum(t_3044_2012)
s12_6
df_age_d4559_2012 = df_2012.loc[(df_2012["Age_group"]=="45-59")]
df_age_d4559_2012
t_4559_2012 = df_age_d4559_2012.loc[:,"Total"]
s12_7 = np.sum(t_4559_2012)
s12_7
df_age_d60_2012 = df_2012.loc[(df_2012["Age_group"]=="60+")]
df_age_d60_2012
t_60_2012 = df_age_d60_2012.loc[:,"Total"]
s12_8 = np.sum(t_60_2012)
s12_8
df_age_d0100_2012 = df_2012.loc[(df_2012["Age_group"]=="0-100+")]
df_age_d0100_2012
t_0100_2012 = df_age_d0100_2012.loc[:,"Total"]
s12_54 = np.sum(t_0100_2012)
s12_54
df_014m_2012 = df_age_d014_2012.loc[(df_age_d014_2012["Gender"]=="Male")]
df_014m_2012
t_014m_2012 = df_014m_2012.loc[:,"Total"]
s12_9 = np.sum(t_014m_2012)
s12_9
df_014fm_2012 = df_age_d014_2012.loc[(df_age_d014_2012["Gender"]=="Female")]
df_014fm_2012
t_014fm_2012 = df_014fm_2012.loc[:,"Total"]
s12_10 = np.sum(t_014fm_2012)
s12_10
df_1529m_2012 = df_age_d1529_2012.loc[(df_age_d1529_2012["Gender"]=="Male")]
df_1529m_2012
t_1529m_2012 = df_1529m_2012.loc[:,"Total"]
s12_11 = np.sum(t_1529m_2012)
s12_11
df_1529fm_2012 = df_age_d1529_2012.loc[(df_age_d1529_2012["Gender"]=="Female")]
df_1529fm_2012
t_1529fm_2012 = df_1529fm_2012.loc[:,"Total"]
s12_12 = np.sum(t_1529fm_2012)
s12_12
df_3044m_2012 = df_age_d3044_2012.loc[(df_age_d3044_2012["Gender"]=="Male")]
df_3044m_2012
t_3044m_2012 = df_3044m_2012.loc[:,"Total"]
s12_13 = np.sum(t_3044m_2012)
s12_13
df_3044fm_2012 = df_age_d3044_2012.loc[(df_age_d3044_2012["Gender"]=="Female")]
df_3044fm_2012
t_3044fm_2012 = df_3044fm_2012.loc[:,"Total"]
s12_14 = np.sum(t_3044fm_2012)
s12_14
df_4559m_2012 = df_age_d4559_2012.loc[(df_age_d4559_2012["Gender"]=="Male")]
df_4559m_2012
t_4559m_2012 = df_4559m_2012.loc[:,"Total"]
s12_15 = np.sum(t_4559m_2012)
s12_15
df_4559fm_2012 = df_age_d4559_2012.loc[(df_age_d4559_2012["Gender"]=="Female")]
df_4559fm_2012
t_4559fm_2012 = df_4559fm_2012.loc[:,"Total"]
s12_16 = np.sum(t_4559fm_2012)
s12_16
df_60m_2012 = df_age_d60_2012.loc[(df_age_d60_2012["Gender"]=="Male")]
df_60m_2012
t_60m_2012 = df_60m_2012.loc[:,"Total"]
s12_17 = np.sum(t_60m_2012)
s12_17
df_60fm_2012 = df_age_d60_2012.loc[(df_age_d60_2012["Gender"]=="Female")]
df_60fm_2012
t_60fm_2012 = df_60fm_2012.loc[:,"Total"]
s12_18 = np.sum(t_60fm_2012)
s12_18
df_0100fm_2012 = df_age_d0100_2012.loc[(df_age_d0100_2012["Gender"]=="Female")]
df_0100fm_2012
t_0100fm_2012 = df_0100fm_2012.loc[:,"Total"]
s12_55 = np.sum(t_0100fm_2012)
s12_55
df_0100m_2012 = df_age_d0100_2012.loc[(df_age_d0100_2012["Gender"]=="Male")]
df_0100m_2012
t_0100m_2012 = df_0100m_2012.loc[:,"Total"]
s12_56 = np.sum(t_0100m_2012)
s12_56
df_st_AN_2012 = df_2012.loc[(df_2012["State"]=="A & N ISLANDS")]
df_st_AN_2012
t_AN_2012 = df_st_AN_2012.loc[:,"Total"]
s12_19 = np.sum(t_AN_2012)
s12_19
df_st_AP_2012 = df_2012.loc[(df_2012["State"]=="ANDHRA PRADESH")]
df_st_AP_2012
t_AP_2012 = df_st_AP_2012.loc[:,"Total"]
s12_20 = np.sum(t_AP_2012)
s12_20
df_st_ARP_2012 = df_2012.loc[(df_2012["State"]=="ARUNACHAL PRADESH")]
df_st_ARP_2012
t_ARP_2012 = df_st_ARP_2012.loc[:,"Total"]
s12_21 = np.sum(t_ARP_2012)
s12_21
df_st_AS_2012 = df_2012.loc[(df_2012["State"]=="ASSAM")]
df_st_AS_2012
t_AS_2012 = df_st_AS_2012.loc[:,"Total"]
s12_22 = np.sum(t_AS_2012)
s12_22
df_st_BH_2012 = df_2012.loc[(df_2012["State"]=="BIHAR")]
df_st_BH_2012
t_BH_2012 = df_st_BH_2012.loc[:,"Total"]
s12_23 = np.sum(t_BH_2012)
s12_23
df_st_CH_2012 = df_2012.loc[(df_2012["State"]=="CHANDIGARH")]
df_st_CH_2012
t_CH_2012 = df_st_CH_2012.loc[:,"Total"]
s12_24 = np.sum(t_CH_2012)
s12_24
df_st_CT_2012 = df_2012.loc[(df_2012["State"]=="CHHATTISGARH")]
df_st_CT_2012
t_CT_2012 = df_st_CT_2012.loc[:,"Total"]
s12_25 = np.sum(t_CT_2012)
s12_25
df_st_DN_2012 = df_2012.loc[(df_2012["State"]=="D & N HAVELI")]
df_st_DN_2012
t_DN_2012 = df_st_DN_2012.loc[:,"Total"]
s12_26 = np.sum(t_DN_2012)
s12_26
df_st_DD_2012 = df_2012.loc[(df_2012["State"]=="DAMAN & DIU")]
df_st_DD_2012
t_DD_2012 = df_st_DD_2012.loc[:,"Total"]
s12_27 = np.sum(t_DD_2012)
s12_27
df_st_DL_2012 = df_2012.loc[(df_2012["State"]=="DELHI (UT)")]
df_st_DL_2012
t_DL_2012 = df_st_DL_2012.loc[:,"Total"]
s12_28 = np.sum(t_DL_2012)
s12_28
df_st_GOA_2012 = df_2012.loc[(df_2012["State"]=="GOA")]
df_st_GOA_2012
t_GOA_2012 = df_st_GOA_2012.loc[:,"Total"]
s12_29 = np.sum(t_GOA_2012)
s12_29
df_st_GJ_2012 = df_2012.loc[(df_2012["State"]=="GUJARAT")]
df_st_GJ_2012
t_GJ_2012 = df_st_GJ_2012.loc[:,"Total"]
s12_30 = np.sum(t_GJ_2012)
s12_30
df_st_HR_2012 = df_2012.loc[(df_2012["State"]=="HARYANA")]
df_st_HR_2012
t_HR_2012 = df_st_HR_2012.loc[:,"Total"]
s12_31 = np.sum(t_HR_2012)
s12_31
df_st_HP_2012 = df_2012.loc[(df_2012["State"]=="HIMACHAL PRADESH")]
df_st_HP_2012
t_HP_2012 = df_st_HP_2012.loc[:,"Total"]
s12_32 = np.sum(t_HP_2012)
s12_32
df_st_JK_2012 = df_2012.loc[(df_2012["State"]=="JAMMU & KASHMIR")]
df_st_JK_2012
t_JK_2012 = df_st_JK_2012.loc[:,"Total"]
s12_33 = np.sum(t_JK_2012)
s12_33
df_st_JH_2012 = df_2012.loc[(df_2012["State"]=="JHARKHAND")]
df_st_JH_2012
t_JH_2012 = df_st_JH_2012.loc[:,"Total"]
s12_34 = np.sum(t_JH_2012)
s12_34
df_st_KN_2012 = df_2012.loc[(df_2012["State"]=="KARNATAKA")]
df_st_KN_2012
t_KN_2012 = df_st_KN_2012.loc[:,"Total"]
s12_35 = np.sum(t_KN_2012)
s12_35
df_st_KER_2012 = df_2012.loc[(df_2012["State"]=="KERALA")]
df_st_KER_2012
t_KER_2012 = df_st_KER_2012.loc[:,"Total"]
s12_36 = np.sum(t_KER_2012)
s12_36
df_st_LD_2012 = df_2012.loc[(df_2012["State"]=="LAKSHADWEEP")]
df_st_LD_2012
t_LD_2012 = df_st_LD_2012.loc[:,"Total"]
s12_37 = np.sum(t_LD_2012)
s12_37
df_st_MP_2012 = df_2012.loc[(df_2012["State"]=="MADHYA PRADESH")]
df_st_MP_2012
t_MP_2012 = df_st_MP_2012.loc[:,"Total"]
s12_38 = np.sum(t_MP_2012)
s12_38
df_st_MH_2012 = df_2012.loc[(df_2012["State"]=="MAHARASHTRA")]
df_st_MH_2012
t_MH_2012 = df_st_MH_2012.loc[:,"Total"]
s12_39 = np.sum(t_MH_2012)
s12_39
df_st_MN_2012 = df_2012.loc[(df_2012["State"]=="MANIPUR")]
df_st_MN_2012
t_MN_2012 = df_st_MN_2012.loc[:,"Total"]
s12_40 = np.sum(t_MN_2012)
s12_40
df_st_MG_2012 = df_2012.loc[(df_2012["State"]=="MEGHALAYA")]
df_st_MG_2012
t_MG_2012 = df_st_MG_2012.loc[:,"Total"]
s12_41 = np.sum(t_MG_2012)
s12_41
df_st_MZ_2012 = df_2012.loc[(df_2012["State"]=="MIZORAM")]
df_st_MZ_2012
t_MN_2012 = df_st_MN_2012.loc[:,"Total"]
s12_42 = np.sum(t_MN_2012)
s12_42
df_st_NG_2012 = df_2012.loc[(df_2012["State"]=="NAGALAND")]
df_st_NG_2012
t_NG_2012 = df_st_NG_2012.loc[:,"Total"]
s12_43 = np.sum(t_NG_2012)
s12_43
df_st_OD_2012 = df_2012.loc[(df_2012["State"]=="ODISHA")]
df_st_OD_2012
t_OD_2012 = df_st_OD_2012.loc[:,"Total"]
s12_44 = np.sum(t_OD_2012)
s12_44
df_st_PD_2012 = df_2012.loc[(df_2012["State"]=="PUDUCHERRY")]
df_st_PD_2012
t_PD_2012 = df_st_PD_2012.loc[:,"Total"]
s12_45 = np.sum(t_PD_2012)
s12_45
df_st_PB_2012 = df_2012.loc[(df_2012["State"]=="PUNJAB")]
df_st_PB_2012
t_PB_2012 = df_st_PB_2012.loc[:,"Total"]
s12_46 = np.sum(t_PB_2012)
s12_46
df_st_RJ_2012 = df_2012.loc[(df_2012["State"]=="RAJASTHAN")]
df_st_RJ_2012
t_RJ_2012 = df_st_RJ_2012.loc[:,"Total"]
s12_47 = np.sum(t_RJ_2012)
s12_47
df_st_SM_2012 = df_2012.loc[(df_2012["State"]=="SIKKIM")]
df_st_SM_2012
t_SM_2012 = df_st_SM_2012.loc[:,"Total"]
s12_48 = np.sum(t_SM_2012)
s12_48
df_st_TN_2012 = df_2012.loc[(df_2012["State"]=="TAMIL NADU")]
df_st_TN_2012
t_TN_2012 = df_st_TN_2012.loc[:,"Total"]
s12_49 = np.sum(t_TN_2012)
s12_49
df_st_TP_2012 = df_2012.loc[(df_2012["State"]=="TRIPURA")]
df_st_TP_2012
t_TP_2012 = df_st_TP_2012.loc[:,"Total"]
s12_50 = np.sum(t_TP_2012)
s12_50
df_st_UP_2012 = df_2012.loc[(df_2012["State"]=="UTTAR PRADESH")]
df_st_UP_2012
t_UP_2012 = df_st_UP_2012.loc[:,"Total"]
s12_51 = np.sum(t_UP_2012)
s12_51
df_st_UK_2012 = df_2012.loc[(df_2012["State"]=="UTTARAKHAND")]
df_st_UK_2012
t_UK_2012 = df_st_UK_2012.loc[:,"Total"]
s12_52 = np.sum(t_UK_2012)
s12_52
df_st_WB_2012 = df_2012.loc[(df_2012["State"]=="WEST BENGAL")]
df_st_WB_2012
t_WB_2012 = df_st_WB_2012.loc[:,"Total"]
s12_53 = np.sum(t_WB_2012)
s12_53
t_ANm_2012 = np.sum(df_st_AN_2012.where(df_st_AN_2012["Gender"]=="Male")["Total"])
t_ANm_2012
t_ANfm_2012 = np.sum(df_st_AN_2012.where(df_st_AN_2012["Gender"]=="Female")["Total"])
t_ANfm_2012
t_APm_2012 = np.sum(df_st_AP_2012.where(df_st_AP_2012["Gender"]=="Male")["Total"])
t_APm_2012
t_APfm_2012 = np.sum(df_st_AP_2012.where(df_st_AP_2012["Gender"]=="Female")["Total"])
t_APfm_2012
t_ARPm_2012 = np.sum(df_st_ARP_2012.where(df_st_ARP_2012["Gender"]=="Male")["Total"])
t_ARPm_2012
t_ARPfm_2012 = np.sum(df_st_ARP_2012.where(df_st_ARP_2012["Gender"]=="Female")["Total"])
t_ARPfm_2012
t_ASm_2012 = np.sum(df_st_AS_2012.where(df_st_AS_2012["Gender"]=="Male")["Total"])
t_ASm_2012
t_ASfm_2012 = np.sum(df_st_AS_2012.where(df_st_AS_2012["Gender"]=="Female")["Total"])
t_ASfm_2012
t_BHm_2012 = np.sum(df_st_BH_2012.where(df_st_BH_2012["Gender"]=="Male")["Total"])
t_BHm_2012
t_BHfm_2012 = np.sum(df_st_BH_2012.where(df_st_BH_2012["Gender"]=="Female")["Total"])
t_BHfm_2012
t_CHm_2012 = np.sum(df_st_CH_2012.where(df_st_CH_2012["Gender"]=="Male")["Total"])
t_CHm_2012
t_CHfm_2012 = np.sum(df_st_CH_2012.where(df_st_CH_2012["Gender"]=="Female")["Total"])
t_CHfm_2012
t_CTm_2012 = np.sum(df_st_CT_2012.where(df_st_CT_2012["Gender"]=="Male")["Total"])
t_CTm_2012
t_CTfm_2012 = np.sum(df_st_CT_2012.where(df_st_CT_2012["Gender"]=="Female")["Total"])
t_CTfm_2012
t_DNm_2012 = np.sum(df_st_DN_2012.where(df_st_DN_2012["Gender"]=="Male")["Total"])
t_DNm_2012
t_DNfm_2012 = np.sum(df_st_DN_2012.where(df_st_DN_2012["Gender"]=="Female")["Total"])
t_DNfm_2012
t_DDm_2012 = np.sum(df_st_DD_2012.where(df_st_DD_2012["Gender"]=="Male")["Total"])
t_DDm_2012
t_DDfm_2012 = np.sum(df_st_DD_2012.where(df_st_DD_2012["Gender"]=="Female")["Total"])
t_DDfm_2012
t_DLm_2012 = np.sum(df_st_DL_2012.where(df_st_DL_2012["Gender"]=="Male")["Total"])
t_DLm_2012
t_DLfm_2012 = np.sum(df_st_DL_2012.where(df_st_DL_2012["Gender"]=="Female")["Total"])
t_DLfm_2012
t_GOAm_2012 = np.sum(df_st_GOA_2012.where(df_st_GOA_2012["Gender"]=="Male")["Total"])
t_GOAm_2012
t_GOAfm_2012 = np.sum(df_st_GOA_2012.where(df_st_GOA_2012["Gender"]=="Female")["Total"])
t_GOAfm_2012
t_GJm_2012 = np.sum(df_st_GJ_2012.where(df_st_GJ_2012["Gender"]=="Male")["Total"])
t_GJm_2012
t_GJfm_2012 = np.sum(df_st_GJ_2012.where(df_st_GJ_2012["Gender"]=="Female")["Total"])
t_GJfm_2012
t_HRm_2012 = np.sum(df_st_HR_2012.where(df_st_HR_2012["Gender"]=="Male")["Total"])
t_HRm_2012
t_HRfm_2012 = np.sum(df_st_HR_2012.where(df_st_HR_2012["Gender"]=="Female")["Total"])
t_HRfm_2012
t_HPm_2012 = np.sum(df_st_HP_2012.where(df_st_HP_2012["Gender"]=="Male")["Total"])
t_HPm_2012
t_HPfm_2012 = np.sum(df_st_HP_2012.where(df_st_HP_2012["Gender"]=="Female")["Total"])
t_HPfm_2012
t_JKm_2012 = np.sum(df_st_JK_2012.where(df_st_JK_2012["Gender"]=="Male")["Total"])
t_JKm_2012
t_JKfm_2012 = np.sum(df_st_JK_2012.where(df_st_JK_2012["Gender"]=="Female")["Total"])
t_JKfm_2012
t_JHm_2012 = np.sum(df_st_JH_2012.where(df_st_JH_2012["Gender"]=="Male")["Total"])
t_JHm_2012
t_JHfm_2012 = np.sum(df_st_JH_2012.where(df_st_JH_2012["Gender"]=="Female")["Total"])
t_JHfm_2012
t_KNm_2012 = np.sum(df_st_KN_2012.where(df_st_KN_2012["Gender"]=="Male")["Total"])
t_KNm_2012
t_KNfm_2012 = np.sum(df_st_KN_2012.where(df_st_KN_2012["Gender"]=="Female")["Total"])
t_KNfm_2012
t_KERm_2012 = np.sum(df_st_KER_2012.where(df_st_KER_2012["Gender"]=="Male")["Total"])
t_KERm_2012
t_KERfm_2012 = np.sum(df_st_KER_2012.where(df_st_KER_2012["Gender"]=="Female")["Total"])
t_KERfm_2012
t_LDm_2012 = np.sum(df_st_LD_2012.where(df_st_LD_2012["Gender"]=="Male")["Total"])
t_LDm_2012
t_LDfm_2012 = np.sum(df_st_LD_2012.where(df_st_LD_2012["Gender"]=="Female")["Total"])
t_LDfm_2012
t_MPm_2012 = np.sum(df_st_MP_2012.where(df_st_MP_2012["Gender"]=="Male")["Total"])
t_MPm_2012
t_MPfm_2012 = np.sum(df_st_MP_2012.where(df_st_MP_2012["Gender"]=="Female")["Total"])
t_MPfm_2012
t_MHm_2012 = np.sum(df_st_MH_2012.where(df_st_MH_2012["Gender"]=="Male")["Total"])
t_MHm_2012
t_MHfm_2012 = np.sum(df_st_MH_2012.where(df_st_MH_2012["Gender"]=="Female")["Total"])
t_MHfm_2012
t_MNm_2012 = np.sum(df_st_MN_2012.where(df_st_MN_2012["Gender"]=="Male")["Total"])
t_MNm_2012
t_MNfm_2012 = np.sum(df_st_MN_2012.where(df_st_MN_2012["Gender"]=="Female")["Total"])
t_MNfm_2012
t_MGm_2012 = np.sum(df_st_MG_2012.where(df_st_MG_2012["Gender"]=="Male")["Total"])
t_MGm_2012
t_MGfm_2012 = np.sum(df_st_MG_2012.where(df_st_MG_2012["Gender"]=="Female")["Total"])
t_MGfm_2012
t_MZm_2012 = np.sum(df_st_MZ_2012.where(df_st_MZ_2012["Gender"]=="Male")["Total"])
t_MZm_2012
t_MZfm_2012 = np.sum(df_st_MZ_2012.where(df_st_MZ_2012["Gender"]=="Female")["Total"])
t_MZfm_2012
t_NGm_2012 = np.sum(df_st_NG_2012.where(df_st_NG_2012["Gender"]=="Male")["Total"])
t_NGm_2012
t_NGfm_2012 = np.sum(df_st_NG_2012.where(df_st_NG_2012["Gender"]=="Female")["Total"])
t_MGfm_2012
t_ODm_2012 = np.sum(df_st_OD_2012.where(df_st_OD_2012["Gender"]=="Male")["Total"])
t_ODm_2012
t_ODfm_2012 = np.sum(df_st_OD_2012.where(df_st_OD_2012["Gender"]=="Female")["Total"])
t_ODfm_2012
t_PDm_2012 = np.sum(df_st_PD_2012.where(df_st_PD_2012["Gender"]=="Male")["Total"])
t_PDm_2012
t_PDfm_2012 = np.sum(df_st_PD_2012.where(df_st_PD_2012["Gender"]=="Female")["Total"])
t_PDfm_2012
t_PBm_2012 = np.sum(df_st_PB_2012.where(df_st_PB_2012["Gender"]=="Male")["Total"])
t_PBm_2012
t_PBfm_2012 = np.sum(df_st_PB_2012.where(df_st_PB_2012["Gender"]=="Female")["Total"])
t_PBfm_2012
t_RJm_2012 = np.sum(df_st_RJ_2012.where(df_st_RJ_2012["Gender"]=="Male")["Total"])
t_RJm_2012
t_RJfm_2012 = np.sum(df_st_RJ_2012.where(df_st_RJ_2012["Gender"]=="Female")["Total"])
t_RJfm_2012
t_SMm_2012 = np.sum(df_st_SM_2012.where(df_st_SM_2012["Gender"]=="Male")["Total"])
t_SMm_2012
t_SMfm_2012 = np.sum(df_st_SM_2012.where(df_st_SM_2012["Gender"]=="Female")["Total"])
t_SMfm_2012
t_TNm_2012 = np.sum(df_st_TN_2012.where(df_st_TN_2012["Gender"]=="Male")["Total"])
t_TNm_2012
t_TNfm_2012 = np.sum(df_st_TN_2012.where(df_st_TN_2012["Gender"]=="Female")["Total"])
t_TNfm_2012
t_TPm_2012 = np.sum(df_st_TP_2012.where(df_st_TP_2012["Gender"]=="Male")["Total"])
t_TPm_2012
t_TPfm_2012 = np.sum(df_st_TP_2012.where(df_st_TP_2012["Gender"]=="Female")["Total"])
t_TPfm_2012
t_UPm_2012 = np.sum(df_st_UP_2012.where(df_st_UP_2012["Gender"]=="Male")["Total"])
t_UPm_2012
t_UPfm_2012 = np.sum(df_st_UP_2012.where(df_st_UP_2012["Gender"]=="Female")["Total"])
t_UPfm_2012
t_UKm_2012 = np.sum(df_st_UK_2012.where(df_st_UK_2012["Gender"]=="Male")["Total"])
t_UKm_2012
t_UKfm_2012 = np.sum(df_st_UK_2012.where(df_st_UK_2012["Gender"]=="Female")["Total"])
t_UKfm_2012
t_WBm_2012 = np.sum(df_st_WB_2012.where(df_st_WB_2012["Gender"]=="Male")["Total"])
t_WBm_2012
t_WBfm_2012 = np.sum(df_st_WB_2012.where(df_st_WB_2012["Gender"]=="Female")["Total"])
t_WBfm_2012
l_2012=list(df_2012.loc[:,"Type"].unique())
l_2012.sort()
print(l_2012,end=" ")
cause_l_2012=[]
for i in l_2012:
rough= np.sum(df_2012.where(df_2012["Type"]==i)["Total"])
cause_l_2012.append(rough)
print(cause_l_2012,end=" ")
x1_2012 = set(df_2012.loc[:,"State"])
x1_2012
len(x1_2012)
cause_df_2012 = pd.DataFrame(cause_l_2012,l_2012)
cause_df_2012.reset_index()
cause_df_2012.plot.bar(stacked=True,figsize=(50,20))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Causes",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths due to Different Causes in 2012",fontsize=55)
plt.legend(["Death Count"], prop={"size":30})
s_2012=list(df_2012.loc[:,"State"].unique())
s_2012.sort()
print(s_2012,end=" ")
state_s_2012 = [s12_19,s12_20,s12_21,s12_22,s12_23,s12_24,s12_25,s12_26,s12_27,s12_28,s12_29,s12_30,s12_31,s12_32,s12_33,s12_34,
s12_35,s12_36,s12_37,s12_38,s12_39,s12_40,s12_41,s12_42,s12_43,s12_44,s12_45,s12_46,s12_47,s12_48,s12_49,s12_50,
s12_51,s12_52,s12_53]
print(state_s_2012,end=" ")
state_m_2012=[t_ANm_2012, t_APm_2012, t_ARPm_2012, t_ASm_2012, t_BHm_2012, t_CHm_2012, t_CTm_2012, t_DNm_2012,
t_DDm_2012, t_DLm_2012, t_GOAm_2012, t_GJm_2012, t_HRm_2012, t_HPm_2012,t_JKm_2012, t_JHm_2012,
t_KNm_2012, t_KERm_2012, t_LDm_2012,t_MPm_2012,t_MHm_2012,t_MNm_2012,t_MGm_2012,t_MZm_2012,
t_NGm_2012, t_ODm_2012, t_PDm_2012,t_PBm_2012,t_RJm_2012,t_SMm_2012,t_TNm_2012,t_TPm_2012,
t_UPm_2012, t_UKm_2012, t_WBm_2012]
print(state_m_2012,end=" ")
state_fm_2012=[t_ANfm_2012, t_APfm_2012, t_ARPfm_2012, t_ASfm_2012, t_BHfm_2012, t_CHfm_2012, t_CTfm_2012, t_DNfm_2012,
t_DDfm_2012, t_DLfm_2012, t_GOAfm_2012, t_GJfm_2012, t_HRfm_2012, t_HPfm_2012,t_JKfm_2012, t_JHfm_2012,
t_KNfm_2012, t_KERfm_2012, t_LDfm_2012,t_MPfm_2012,t_MHfm_2012,t_MNfm_2012,t_MGfm_2012,t_MZfm_2012,
t_NGfm_2012, t_ODfm_2012, t_PDfm_2012,t_PBfm_2012,t_RJfm_2012,t_SMfm_2012,t_TNfm_2012,t_TPfm_2012,
t_UPfm_2012, t_UKfm_2012, t_WBfm_2012]
print(state_fm_2012,end=" ")
df_state_2012 = {
"State":['A & N ISLANDS', 'ANDHRA PRADESH', 'ARUNACHAL PRADESH', 'ASSAM', 'BIHAR', 'CHANDIGARH', 'CHHATTISGARH',
'D & N HAVELI', 'DAMAN & DIU', 'DELHI (UT)', 'GOA', 'GUJARAT', 'HARYANA', 'HIMACHAL PRADESH', 'JAMMU & KASHMIR',
'JHARKHAND', 'KARNATAKA', 'KERALA', 'LAKSHADWEEP', 'MADHYA PRADESH', 'MAHARASHTRA', 'MANIPUR', 'MEGHALAYA',
'MIZORAM', 'NAGALAND', 'ODISHA', 'PUDUCHERRY', 'PUNJAB', 'RAJASTHAN', 'SIKKIM', 'TAMIL NADU', 'TRIPURA',
'UTTAR PRADESH', 'UTTARAKHAND', 'WEST BENGAL'],
"Total":[s12_19,s12_20,s12_21,s12_22,s12_23,s12_24,s12_25,s12_26,s12_27,s12_28,s12_29,s12_30,s12_31,s12_32,s12_33,s12_34,
s12_35,s12_36,s12_37,s12_38,s12_39,s12_40,s12_41,s12_42,s12_43,s12_44,s12_45,s12_46,s12_47,s12_48,s12_49,s12_50,
s12_51,s12_52,s12_53],
"Male":[t_ANm_2012, t_APm_2012, t_ARPm_2012, t_ASm_2012, t_BHm_2012, t_CHm_2012, t_CTm_2012, t_DNm_2012,
t_DDm_2012, t_DLm_2012, t_GOAm_2012, t_GJm_2012, t_HRm_2012, t_HPm_2012,t_JKm_2012, t_JHm_2012,
t_KNm_2012, t_KERm_2012, t_LDm_2012,t_MPm_2012,t_MHm_2012,t_MNm_2012,t_MGm_2012,t_MZm_2012,
t_NGm_2012, t_ODm_2012, t_PDm_2012,t_PBm_2012,t_RJm_2012,t_SMm_2012,t_TNm_2012,t_TPm_2012,
t_UPm_2012, t_UKm_2012, t_WBm_2012],
"Female":[t_ANfm_2012, t_APfm_2012, t_ARPfm_2012, t_ASfm_2012, t_BHfm_2012, t_CHfm_2012, t_CTfm_2012, t_DNfm_2012,
t_DDfm_2012, t_DLfm_2012, t_GOAfm_2012, t_GJfm_2012, t_HRfm_2012, t_HPfm_2012,t_JKfm_2012, t_JHfm_2012,
t_KNfm_2012, t_KERfm_2012, t_LDfm_2012,t_MPfm_2012,t_MHfm_2012,t_MNfm_2012,t_MGfm_2012,t_MZfm_2012,
t_NGfm_2012, t_ODfm_2012, t_PDfm_2012,t_PBfm_2012,t_RJfm_2012,t_SMfm_2012,t_TNfm_2012,t_TPfm_2012,
t_UPfm_2012, t_UKfm_2012, t_WBfm_2012]
}
df_All_st_2012 = pd.DataFrame(df_state_2012)
df_All_st_2012
pivot_2012 = pd.pivot_table(df_All_st_2012, values=None, index='State', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_2012
pivot_2012.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("States",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Males And Females In Different State",fontsize=55)
plt.legend(["Female","Male","Total"], prop={"size":30})
plt.show
cause_l_percent_2012=[]
for i in cause_l_2012:
p=i/np.sum(cause_l_2012)
avg_2012_cause=p*100
cause_l_percent_2012.append(avg_2012_cause)
print(cause_l_percent_2012,end=" ")
np.max(cause_l_percent_2012) #Married
np.min(cause_l_percent_2012) #Ideological Causes/Hero Worshipping
state_s_2012_percent=[]
tot=np.sum(state_s_2012)
for i in state_s_2012:
xy=i/tot
avg_state_2012=xy*100
state_s_2012_percent.append(avg_state_2012)
print(state_s_2012_percent,end=" ")
np.max(state_s_2012_percent) #Maharashtra
np.min(state_s_2012_percent) #Lakshdweep
l_age_grp_2012=[s12_4,s12_5,s12_6,s12_7,s12_8,s12_54]
l_age_grp_2012
l_age_grp_2012_percent=[]
for i in l_age_grp_2012:
yz=i/s12_1
avg_2012_age_grp=yz*100
l_age_grp_2012_percent.append(avg_2012_age_grp)
l_age_grp_2012_percent
np.max(l_age_grp_2012_percent) #0-100+
np.min(l_age_grp_2012_percent) #0-14
total_male_percent_2012= (s12_2/s12_1)*100
total_male_percent_2012
total_female_percent_2012= (s12_3/s12_1)*100
total_female_percent_2012
dict_yr = {
"Years":[2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012],
"Male":[s1_2,s2_2,s3_2,s4_2,s5_2,s6_2,s7_2,s8_2,s9_2,s10_2,s11_2,s12_2],
"Female":[s1_3,s2_3,s3_3,s4_3,s5_3,s6_3,s7_3,s8_3,s9_3,s10_3,s11_3,s12_3],
"Total": [s1_1,s2_1,s3_1,s4_1,s5_1,s6_1,s7_1,s8_1,s9_1,s10_1,s11_1,s12_1]
}
all_df = pd.DataFrame(dict_yr)
all_df
pivot_allyr = pd.pivot_table(all_df, values=None, index="Years", columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_allyr
pivot_allyr.plot(kind='bar',figsize=(10,8))
plt.xlabel("Years",fontsize=15)
plt.ylabel("Death Count",fontsize=12)
df_agegrp_allyr = {
"Years":[2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012],
"0-14":[s1_4,s2_4,s3_4,s4_4,s5_4,s6_4,s7_4,s8_4,s9_4,s10_4,s11_4,s12_4],
"15-29":[s1_5,s2_5,s3_5,s4_5,s5_5,s6_5,s7_5,s8_5,s9_5,s10_5,s11_5,s12_5],
"30-44":[s1_6,s2_6,s3_6,s4_6,s5_6,s6_6,s7_6,s8_6,s9_6,s10_6,s11_6,s12_6],
"45-59":[s1_7,s2_7,s3_7,s4_7,s5_7,s6_7,s7_7,s8_7,s9_7,s10_7,s11_7,s12_7],
"60+":[s1_8,s2_8,s3_8,s4_8,s5_8,s6_8,s7_8,s8_8,s9_8,s10_8,s11_8,s12_8],
"0-100+":[s1_54,s2_54,s3_54,s4_54,s5_54,s6_54,s7_54,s8_54,s9_54,s10_54,s11_54,s12_54]
}
df_all_agegrp_allyr=pd.DataFrame(df_agegrp_allyr)
df_all_agegrp_allyr
pivot_agegrp_all = pd.pivot_table(df_all_agegrp_allyr, values=None, index='Years', columns=None,
fill_value=None, margins=False, dropna=True, margins_name='All', observed=False)
pivot_agegrp_all
pivot_agegrp_all.plot(kind='bar',figsize=(60,30))
plt.tick_params(axis='y', labelsize=33)
plt.tick_params(axis='x', labelsize=33)
plt.xlabel("Years",fontsize=40)
plt.ylabel("Death Count",fontsize=40)
plt.title("Number of Deaths of Diffrent AgeGroups Year-Wise",fontsize=55)
plt.legend(["0-100+","0-14","15-29","30-44","45-59","60+"], prop={"size":30})
plt.show